예제 #1
0
    public void Escape(BasicEnemy enemy)
    {
        BasicEntity entity = enemy.m_entity;
        VoxelBlocks map    = GameObject.Find("Voxel Map").GetComponent <VoxelBlocks> ();

        List <BasicEntity> enemyList = entity.GetComponent <MonitorComponent> ().m_enemy;

        if (AiToInput.CallFriend(entity, enemyList))
        {
            //呼叫成功
            StateComponent state = entity.GetComponent <StateComponent> ();

            state.AnimationStart();

            state.m_actionPoint -= 1;
            state.Invoke("AnimationEnd", 1);
            return;
        }

        Vector3 escapePos = FindPath.GetNearestFriend(entity.GetComponent <BlockInfoComponent> ().m_logicPosition);

        if (escapePos == Vector3.down)
        {
            //无路可走等死
            return;
        }
        else
        {
            AiToInput.Move(entity, escapePos);
        }
        return;
    }