using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StartObjective : Objective {
GameObject playerPrefab;
///
/// Creates a new StartObjective instance.
///
///
///
public StartObjective(Room room, GameObject playerPrefab) : base(room) {
this.playerPrefab = playerPrefab;
}
// TODO not as good as possible. Should Objectives ActivateGoal method require a player obj?
///
/// Handle activation code for a goal.
///
/// Player is ignored
public override void ActivateGoal(Player player) {
if ( room.GetSpawnpoints().Count > 0 ) {
GameObject ply = GameObject.Instantiate(playerPrefab);
ply.transform.position = room.GetSpawnpoints()[0].position;
player = ply.GetComponent();
base.ActivateGoal(player);
}
}
///
/// Returns the created Player object. Call this after !
///
/// Player
public Player GetPlayer() {
return player;
}
///
/// Code executed if the goal is reached eg. opening doors.
///
public override void UpdateGoal() {
ReachedGoal();
}
}