1
0
Fork 0
Bildschirmflausch-LD41/Assets/Scripts/Objectives/FinishObjective.cs
Piegames 5717dd259b Win with the flag
(TODO for the flag)
2018-04-23 19:39:37 +02:00

24 lines
641 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FinishObjective : Objective {
public FinishObjective(Room caller) : base(caller) { }
public override void ActivateGoal(Player player) {
// Player reached the end => win
base.ActivateGoal(player);
UpdateGoal();
}
public override void UpdateGoal() {
if ((room.GetCenter() - (Vector2)player.transform.position).magnitude < 2)
ReachedGoal();
}
protected override void ReachedGoal() {
base.ReachedGoal();
GameController.instance.EndGame(GameController.EndedCause.WIN);
}
}