Пример #1
0
    /// <summary>
    /// 玩家Ai坦克碰上范围触发器后执行.
    /// </summary>
    public void OnHitAiMoveTrigger(SSTriggerAiPlayerMove.TiggerState type)
    {
        if (IsOpenPlayerAiMove == false)
        {
            return;
        }

        if (m_PlayerMoveCom == null)
        {
            UnityLogWarning("OnHitAiMoveTrigger -> m_PlayerMoveCom was null..........");
            return;
        }

        DirectionMove dirMove = GetPlayerMoveDirOnHitTrigger(type);

        m_RandMoveTime = Random.Range(1f, 3f);
        m_LastMoveTime = Time.time;
        OnChangePlayerMoveDirBtInfo(dirMove);
    }
Пример #2
0
    /// <summary>
    /// 当玩家碰上范围触发器时获取随机运动方向.
    /// </summary>
    DirectionMove GetPlayerMoveDirOnHitTrigger(SSTriggerAiPlayerMove.TiggerState type)
    {
        int           randVal = Random.Range(0, 100) % 5;
        DirectionMove dirType = DirectionMove.Stop;

        switch (type)
        {
        case SSTriggerAiPlayerMove.TiggerState.Qian:
        {
            if (randVal == 0)
            {
                dirType = DirectionMove.Zuo;
            }
            else if (randVal == 1)
            {
                dirType = DirectionMove.ZuoHou;
            }
            else if (randVal == 2)
            {
                dirType = DirectionMove.Hou;
            }
            else if (randVal == 3)
            {
                dirType = DirectionMove.YouHou;
            }
            else if (randVal == 4)
            {
                dirType = DirectionMove.You;
            }
            break;
        }

        case SSTriggerAiPlayerMove.TiggerState.Hou:
        {
            if (randVal == 0)
            {
                dirType = DirectionMove.Zuo;
            }
            else if (randVal == 1)
            {
                dirType = DirectionMove.ZuoQian;
            }
            else if (randVal == 2)
            {
                dirType = DirectionMove.Qian;
            }
            else if (randVal == 3)
            {
                dirType = DirectionMove.YouQian;
            }
            else if (randVal == 4)
            {
                dirType = DirectionMove.You;
            }
            break;
        }

        case SSTriggerAiPlayerMove.TiggerState.Zuo:
        {
            if (randVal == 0)
            {
                dirType = DirectionMove.Hou;
            }
            else if (randVal == 1)
            {
                dirType = DirectionMove.YouHou;
            }
            else if (randVal == 2)
            {
                dirType = DirectionMove.You;
            }
            else if (randVal == 3)
            {
                dirType = DirectionMove.YouQian;
            }
            else if (randVal == 4)
            {
                dirType = DirectionMove.Qian;
            }
            break;
        }

        case SSTriggerAiPlayerMove.TiggerState.You:
        {
            if (randVal == 0)
            {
                dirType = DirectionMove.Hou;
            }
            else if (randVal == 1)
            {
                dirType = DirectionMove.ZuoHou;
            }
            else if (randVal == 2)
            {
                dirType = DirectionMove.Zuo;
            }
            else if (randVal == 3)
            {
                dirType = DirectionMove.ZuoQian;
            }
            else if (randVal == 4)
            {
                dirType = DirectionMove.Qian;
            }
            break;
        }
        }
        return(dirType);
    }