コード例 #1
0
ファイル: Actions.cs プロジェクト: loudax/3d-game
    public static PatrolFollowAction GetSSAction(GameObject player)
    {
        PatrolFollowAction action = CreateInstance <PatrolFollowAction>();

        action.player = player;
        return(action);
    }
コード例 #2
0
    private void startCatching(int id, GameObject hero)
    {
        PatrolFollowAction action = PatrolFollowAction.GetAction(hero, 0.3f);

        patrols[id].GetComponent <PatrolData>().active = true;
        action_manager.RunAction(patrols[id], action, this.action_manager);
        //Debug.Log(id);
    }
コード例 #3
0
    public static PatrolFollowAction GetAction(GameObject target, float speed)
    {
        PatrolFollowAction action = ScriptableObject.CreateInstance <PatrolFollowAction>();

        action.target = target;
        action.speed  = speed;
        return(action);
    }
コード例 #4
0
    public static PatrolFollowAction getSSAction(GameObject player)
    {
        // Debug.Log("getSSAction in PatrolFollowAction");
        PatrolFollowAction action = ScriptableObject.CreateInstance <PatrolFollowAction>();

        action.player     = player;
        action.stepLength = Random.Range(3, 5);
        return(action);
    }
コード例 #5
0
 public void SSActionEvent(SSAction source, int intParam = 0, GameObject objectParam = null)
 {
     if (intParam == 0)
     {
         action = PatrolFollowAction.GetSSAction();
     }
     else if (intParam == 1)
     {
         action = PatrolAction.GetSSAction();
     }
     this.RunAction(objectParam, action, this);
 }
コード例 #6
0
ファイル: Actions.cs プロジェクト: loudax/3d-game
 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
     {
         GoPatrolAction move = GoPatrolAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().start_position);
         this.RunAction(objectParam, move, this);
         Singleton <GameEventManager> .Instance.PlayerEscape();
     }
 }
コード例 #7
0
 public void SSActionEvent(SSAction source,
                           int intParam,
                           GameObject objectParam)
 {
     if (intParam == 0)
     {
         PatrolFollowAction follow = PatrolFollowAction.getSSAction(objectParam);
         this.RunAction(objectParam, follow, this);
     }
     else
     {
         PatrolAction move = PatrolAction.getSSAction(objectParam.transform.position);
         this.RunAction(objectParam, move, this);
     }
 }
コード例 #8
0
 //针对这次游戏新增的一个方法,用于增加不同的动作
 public void SSActionEvent(SSAction source, bool catching = false, GameObject objectParam = null)
 {
     //不捉玩家时,自由移动
     if (!catching)
     {
         GoPatrolAction goPatrolAction = GoPatrolAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().start_position);
         RunAction(objectParam, goPatrolAction, this);
         Singleton <GameEventManager> .Instance.PlayerEscape();
     }
     //捕捉玩家时,跟着玩家走
     else
     {
         PatrolFollowAction patrolFollowAction = PatrolFollowAction.GetSSAction(objectParam.gameObject.GetComponent <PatrolData>().player);
         RunAction(objectParam, patrolFollowAction, this);
     }
 }
コード例 #9
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();
     }
 }
コード例 #10
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();
     }
 }
コード例 #11
0
 // 追击
 public void Follow(GameObject player, GameObject patrol)
 {
     this.follow = PatrolFollowAction.GetAction(player);
     this.RunAction(patrol, follow, this);
 }
コード例 #12
0
ファイル: Action.cs プロジェクト: guojj33/Unity3DLearning
 // 追击
 public void Follow(GameObject player, GameObject patrol)
 {
     this.follow = PatrolFollowAction.GetAction(player);
     Debug.Log("PatrolActionManager.Follow()");
     this.RunAction(patrol, follow, this);
 }
コード例 #13
0
    public static PatrolFollowAction GetSSAction()
    {
        PatrolFollowAction action = ScriptableObject.CreateInstance <PatrolFollowAction>();

        return(action);
    }