public void setDirection(GameObject plane, GameObject directionArrow, AgentType owner) { _animator = GetComponent <Animator>(); _owner = owner; _directionArrow = directionArrow; switch (owner) { case AgentType.PLAYER: { _currentPath[0] = plane.transform.Find("Initial1").gameObject; _currentPath[1] = plane.transform.Find("Path1_1").gameObject; _currentPath[2] = plane.transform.Find("Path1_2").gameObject; _currentPath[3] = plane.transform.Find("Path1_21").gameObject; _currentPath[4] = plane.transform.Find("Path2_21").gameObject; _currentPath[5] = plane.transform.Find("Path2_2").gameObject; _currentPath[6] = plane.transform.Find("Path2_1").gameObject; _currentPath[7] = plane.transform.Find("Initial2").gameObject; _auxiliarPath[0] = plane.transform.Find("Initial1").gameObject; _auxiliarPath[1] = plane.transform.Find("Path1_1").gameObject; _auxiliarPath[2] = plane.transform.Find("Path1_2").gameObject; _auxiliarPath[3] = plane.transform.Find("Path1_22").gameObject; _auxiliarPath[4] = plane.transform.Find("Path2_22").gameObject; _auxiliarPath[5] = plane.transform.Find("Path2_2").gameObject; _auxiliarPath[6] = plane.transform.Find("Path2_1").gameObject; _auxiliarPath[7] = plane.transform.Find("Initial2").gameObject; break; } case AgentType.ENEMY: { _currentPath[0] = plane.transform.Find("Initial2").gameObject; _currentPath[1] = plane.transform.Find("Path2_1").gameObject; _currentPath[2] = plane.transform.Find("Path2_2").gameObject; _currentPath[3] = plane.transform.Find("Path2_21").gameObject; _currentPath[4] = plane.transform.Find("Path1_21").gameObject; _currentPath[5] = plane.transform.Find("Path1_2").gameObject; _currentPath[6] = plane.transform.Find("Path1_1").gameObject; _currentPath[7] = plane.transform.Find("Initial1").gameObject; _auxiliarPath[0] = plane.transform.Find("Initial2").gameObject; _auxiliarPath[1] = plane.transform.Find("Path2_1").gameObject; _auxiliarPath[2] = plane.transform.Find("Path2_2").gameObject; _auxiliarPath[3] = plane.transform.Find("Path2_22").gameObject; _auxiliarPath[4] = plane.transform.Find("Path1_22").gameObject; _auxiliarPath[5] = plane.transform.Find("Path1_2").gameObject; _auxiliarPath[6] = plane.transform.Find("Path1_1").gameObject; _auxiliarPath[7] = plane.transform.Find("Initial1").gameObject; break; } } _animator.SetInteger("direction", (int)_facing); _area = plane.GetComponent <BattleGameArea>(); this.transform.position = _currentPath[0].transform.position; _nextPath++; }
public override void Initialize() { base.Initialize(); _battleGameArea = _area.GetComponent <BattleGameArea>(); Reset(); }