// Use this for initialization protected new void Start() { model = Instantiate(modelPrefab, transform.position, transform.rotation) as Transform; model.SetParent(transform, true); guiCanvas = GameObject.Find ("HUD"); base.Start(); _state = EnemyPlaneState.STATE_PATROL; _healthBar = transform.Find("Health").GetComponent<Slider>(); _healthBar.transform.SetParent(guiCanvas.transform); _healthFill = _healthBar.GetComponentsInChildren<UnityEngine.UI.Image>() .FirstOrDefault(t => t.name == "Fill"); //TODO: Find front of colliders frontOfPlane = 9.76f; //TODO: Read the waypoints and start position from a file or the scene. _wayPoints = new List<Vector2>(); addWayPoint(0.0f, 4.0f); addWayPoint(-1.0f, 5.0f); addWayPoint(-4.0f, 5.0f); addWayPoint(-5.0f, 4.0f); addWayPoint(-5.0f, 1.0f); addWayPoint(-4.0f, 0.0f); addWayPoint(2.0f, 0.0f); addWayPoint(3.0f, -1.0f); addWayPoint(3.0f, -2.0f); addWayPoint(2.0f, -3.0f); addWayPoint(1.0f, -3.0f); addWayPoint(0.0f, -2.0f); _player = GameObject.Find("PlayerPlane"); if (_player != null) { _playerPlane = _player.GetComponent<PlayerPlaneScript>(); _playerPlane.addEnemy(this); _arrow = transform.FindChild("Arrow").gameObject; _arrow.transform.SetParent(null); } }
void Awake() { PlayerS = this; }
public void UnregisterPlayer(PlayerPlaneScript thePlayer) { _playerPlane = null; Destroy (_arrow); _state = EnemyPlaneState.STATE_PATROL; }