private PatrolData data;                            // 巡逻兵的数据

    public static PatrolMoveAction GetSSAction(Vector3 location)
    {
        PatrolMoveAction action = CreateInstance <PatrolMoveAction>();

        action.posX = location.x;
        action.posZ = location.z;

        action.rectLength = Random.Range(5, 8);
        return(action);
    }
Exemplo n.º 2
0
    //返回一个动作,继承SSAction
    public static PatrolMoveAction GetSSAction(Vector3 location)
    {
        PatrolMoveAction action = CreateInstance <PatrolMoveAction>();

        action.pos_x = location.x;
        action.pos_z = location.z;
        //设定移动矩形的边长
        action.move_length = Random.Range(3, 5);
        return(action);
    }
Exemplo n.º 3
0
 //根据传入参数来选择执行不同的动作
 public void SSActionEvent(SSAction source, int intParam = 0, GameObject objectParam = null)
 {
     if (intParam == 0)
     {
         //侦查兵跟随玩家
         PatrolFollowAction follow = PatrolFollowAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().player);
         this.RunAction(objectParam, follow, this);
     }
     else
     {
         //侦察兵按照初始位置开始继续巡逻
         PatrolMoveAction move = PatrolMoveAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().start_position);
         this.RunAction(objectParam, move, this);
         //玩家逃脱
         Singleton <GameEventManager> .Instance.AddScore();
     }
 }
Exemplo n.º 4
0
 public void SSActionEvent(SSAction source,
                           SSActionEventType events = SSActionEventType.Compeleted,
                           int intParam             = 0,
                           string strParam          = null,
                           GameObject objectParam   = null)
 {
     //回调函数,动作执行完后调用
     if (intParam == 0)
     {
         //开始跟随玩家
         PatrolFollowAction follow = PatrolFollowAction.GetSSAction(sceneController.player);
         this.RunAction(objectParam, follow, this);
     }
     else
     {
         //丢失目标,继续巡逻
         PatrolMoveAction move = PatrolMoveAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().initPosition);
         this.RunAction(objectParam, move, this);
         //玩家逃脱
         Singleton <GameEventManager> .Instance.PlayerEscape();
     }
 }
Exemplo n.º 5
0
 public void PatrolMove(GameObject patrol)
 {
     move = PatrolMoveAction.GetSSAction(patrol.transform.position);
     this.RunAction(patrol, move, this);
 }