public void Survey(BasicEntity entity)
    {
        List <Vector3> voice    = entity.GetComponent <MonitorComponent> ().m_voice;
        Vector3        mPos     = entity.GetComponent <BlockInfoComponent> ().m_logicPosition;
        List <Vector3> newVoice = new List <Vector3> ();
        List <int>     i        = new List <int> ();

        for (int j = 0; j < voice.Count; j++)
        {
            Vector3 pos = voice [j];
            if (mPos != pos && FindPath.GetPathByStep(mPos, pos, 100) != Vector3.down)
            {
                newVoice.Add(pos);
            }
            else
            {
                i.Add(j);
            }
        }
        for (int j = 0; j < i.Count; j++)
        {
            voice.Remove(voice [i [j]]);
        }

        if (newVoice.Count != 0)
        {
            AiToInput.Move(entity, newVoice [newVoice.Count - 1]);
        }
    }
Esempio n. 2
0
    static public bool Move(BasicEntity entity, Vector3 pos)
    {
        InputComponent input = entity.GetComponent <InputComponent> ();
        StateComponent state = entity.GetComponent <StateComponent> ();
        MoveComponent  move  = entity.GetComponent <MoveComponent> ();

        if (input == null)
        {
            return(false);
        }
        Vector3 nPos = FindPath.GetPathByStep(entity.GetComponent <BlockInfoComponent> ().m_logicPosition, pos, move.SPD * state.m_actionPoint);
        int     key  = GetAbilityCount(entity, ComponentType.Move);

        input.currentKey     = key;
        input.currentPos     = nPos;
        input.leftButtonDown = true;
        return(true);
    }