Пример #1
0
    // Use this for initialization
    protected void Start()
    {
        CurrentPower            = MaxPower;
        b_isPowerDraining       = false;
        currentAction           = E_Action.IDLE;
        m_destinationCheckpoint = null;
        manager = GameManager.GetInstance();

        //register Events
        GameManager.GetInstance().PauseEvent.AddListener(OnPause);

        //define agent
        agent = GetComponent <NavMeshAgent>();

        //get enemy tower object
        foreach (GameObject tower in GameManager.GetInstance().Towers)
        {
            TowerManagement man = tower.GetComponent <TowerManagement>();
            if (man != null)
            {
                if (man.Team != Team)
                {
                    m_enemyTower = tower;
                }
                else
                {
                    m_teamTower = tower;
                }
            }
        }
        //define node AI
        DefineNode();
        m_communicator = m_teamTower.GetComponent <Communicator>();
    }
Пример #2
0
 Node.NodeState BackToTowerAction()
 {
     Debug.Log("Back to tower action");
     currentAction = E_Action.BACK_TO_TOWER;
     m_communicator.DeleteMessage(gameObject);
     return(Node.NodeState.RUNNING);
 }
Пример #3
0
 Node.NodeState DeleteAllAction()
 {
     currentAction = E_Action.IDLE;
     return(Node.NodeState.SUCCESS);
 }
Пример #4
0
 Node.NodeState GotoCheckPointAction()
 {
     Debug.Log("Goto checkpoint");
     currentAction = E_Action.GOTO_CHECKPOINT;
     return(Node.NodeState.RUNNING);
 }