コード例 #1
0
 private void OnChange(CollectionManager.CollectionType type, Action.Type actionType, int count, int changeValue)
 {
     if (type == collectionType)
     {
         UpdateValue(count);
     }
 }
コード例 #2
0
 public void AddCurrentAction(Action.Type type)
 {
     actions.Add(new Action()
     {
         time = Time.time - Game.instance.loopStart, type = type, executed = false
     });
 }
コード例 #3
0
ファイル: ClimbAction.cs プロジェクト: hwong443/Time
 public override bool SwitchActionCheck(Action.Type type)
 {
     SetTriggerNextAction(false);
     StopAction();
     Debug.Log("trigger normal action");
     return(true);
 }
コード例 #4
0
        public static void SetAction(ref Action action, Action.Type type)
        {
            Debug.Assert(pInstance != null);

            switch (type)
            {
            case Action.Type.Attack:
                action = pInstance.poActAttack;
                break;

            case Action.Type.SuperAttack:
                action = pInstance.poActSuperAttack;
                break;

            case Action.Type.Charge:
                action = pInstance.poActCharge;
                break;

            case Action.Type.Defend:
                action = pInstance.poActDefend;
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
コード例 #5
0
 public override bool SwitchActionCheck(Action.Type type)
 {
     isActionDone = true;
     SetTriggerNextAction(false);
     StopAction();
     return(true);
 }
コード例 #6
0
 public void ReceiveAction(Action.Type actionType, int playerId)
 {
     if (actionType == Action.Type.move || isGrowing)
     {
         return;
     }
     else if (actionType == Action.Type.plant)
     {
         if (stage == Stage.seed)
         {
             GrowthAction(playerId);
         }
     }
     else if (actionType == Action.Type.water)
     {
         if (stage == Stage.sapling)
         {
             GrowthAction(playerId);
         }
     }
     else if (actionType == Action.Type.pick)
     {
         if (stage == Stage.tree)
         {
             GrowthAction(playerId);
         }
     }
 }
コード例 #7
0
 private void OnChange(CollectionManager.CollectionType type, Action.Type actionType, int count, int changeValue)
 {
     if (type == CollectionManager.CollectionType.COIN && actionType == Action.Type.ADD)
     {
         IncreaseXP(changeValue);
     }
 }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        // Perform actions at random
        if (actions.Length > 0 && !IsPerformingAction())
        {
            Debug.Log("Performing action...");

            // Perform queued up action if there's one present
            Action action;
            if (nextAction != Action.Type.NONE)
            {
                action     = GetActionByType(nextAction);
                nextAction = Action.Type.NONE;
            }
            // or just select a random idle action
            else
            {
                action = SelectIdleAction();
            }

            // Check that we found an action with the specified type before executing
            if (action)
            {
                action.Execute();
            }
        }
    }
コード例 #9
0
ファイル: InputManager.cs プロジェクト: DirtyWine/BBZ-Qi
 public void OnClickDefend()
 {
     if (lastInput != Action.Type.Defend)
     {
         this.pPunTurnManager.SendMove(Action.Type.Defend, false);
         lastInput = Action.Type.Defend;
     }
 }
コード例 #10
0
ファイル: InputManager.cs プロジェクト: DirtyWine/BBZ-Qi
 public void OnClickCharge()
 {
     if (lastInput != Action.Type.Charge)
     {
         this.pPunTurnManager.SendMove(Action.Type.Charge, false);
         lastInput = Action.Type.Charge;
     }
 }
コード例 #11
0
ファイル: InputManager.cs プロジェクト: DirtyWine/BBZ-Qi
 public void OnClickUltiAttack()
 {
     if (lastInput != Action.Type.SuperAttack)
     {
         this.pPunTurnManager.SendMove(Action.Type.SuperAttack, false);
         lastInput = Action.Type.SuperAttack;
     }
 }
コード例 #12
0
ファイル: Action.cs プロジェクト: hwong443/Time
 public virtual bool SwitchActionCheck(Action.Type type)
 {
     isActionDone = true;
     SetTriggerNextAction(false);
     StopAction();
     Debug.Log("trigger normal action");
     return(true);
 }
コード例 #13
0
 public void RegisterChangedPrimitive(DataPrimitive primitive, Action.Type type, params object[] parameters)
 {
     ObservedChangedPrimitives.Enqueue(new Action
     {
         primitive  = primitive,
         type       = type,
         parameters = parameters
     });
 }
コード例 #14
0
    public void Unsubscribe(string source, Action.Type type, EventHandler <ActionArgs> function)
    {
        var key = new Action(machine.GetElementByName(source), type);

        if (actions.ContainsKey(key))
        {
            actions[key] -= function;
        }
    }
コード例 #15
0
ファイル: RushAction.cs プロジェクト: hwong443/Time
 public override bool SwitchActionCheck(Action.Type type)
 {
     if (type == Action.Type.Attack) {
         //isActionDone = true;
         SetTriggerNextAction (false);
         StopAction ();
         return true;
     }
     return false;
 }
コード例 #16
0
 void DoActions(IEnumerable <int> nodes, Action.Type type)
 {
     foreach (var o in nodes)
     {
         var action = new Action(o, type);
         if (actions.TryGetValue(action, out EventHandler <ActionArgs> act))
         {
             act?.Invoke(this, new ActionArgs(o.ToString(), type));
         }
     }
 }
コード例 #17
0
 /// <summary>
 /// Returns action with associated type, or null if none found
 /// </summary>
 protected Action GetActionByType(Action.Type type)
 {
     // If an action coroutine is in progress, return true
     foreach (Action action in actions)
     {
         if (action.type == type)
         {
             return(action);
         }
     }
     return(null);
 }
コード例 #18
0
ファイル: Character.cs プロジェクト: malyvsen/Hyperloop
    private void Update()
    {
        if (isPlayerVessel)
        {
            Action.Type actionMaybe = Action.fromInput;
            if (actionMaybe != Action.Type.none)
            {
                timeline.AddCurrentAction(actionMaybe);
            }
        }

        Action currentAction = timeline.currentAction;

        if (currentAction != null)
        {
            switch (currentAction.type)
            {
            case Action.Type.moveRight:
                transform.forward = Vector3.right;
                animator.SetBool(walkAnimBool, true);
                goingRight    = true;
                rightPrecedes = true;
                break;

            case Action.Type.stopRight:
                animator.SetBool(walkAnimBool, false);
                goingRight = false;
                break;

            case Action.Type.moveLeft:
                transform.forward = Vector3.left;
                animator.SetBool(walkAnimBool, true);
                goingLeft     = true;
                rightPrecedes = false;
                break;

            case Action.Type.stopLeft:
                animator.SetBool(walkAnimBool, false);
                goingLeft = false;
                break;

            case Action.Type.useObject:
                Lever.UseFromPosition(transform.position);
                break;
            }
            currentAction.executed = true;
        }


        rigidbody.velocity = new Vector3(velocityHorizontal, rigidbody.velocity.y, 0f);
    }
コード例 #19
0
    private void Change(ref int collection, Action.Type actionType, int changeValue)
    {
        switch (actionType)
        {
        case Action.Type.ADD:
            collection += changeValue;
            break;

        case Action.Type.SPEND:
            collection -= changeValue;
            break;

        case Action.Type.VALUE:
            collection = changeValue;
            break;
        }
    }
コード例 #20
0
ファイル: Action.cs プロジェクト: hwong443/Time
    public bool SwitchAction(Action.Type type)
    {
        // can cancel action
        if (isActionDone || isCancelable)
        {
            isActionDone = true;
            return(true);
        }

        // can override action
        bool isNextAction = (triggerNextAction && nextAction != null && type == nextAction.GetType());

        if (isNextAction)
        {
            isActionDone = true;
            return(true);
        }
        else
        {
            return(SwitchActionCheck(type));
        }
    }
コード例 #21
0
    public void PlayAnimation(Action.Type actionType, Vector2 direction, bool isIdle = false)
    {
        string[] directionAnimations = idleDirectionAnimations;
        if (actionType == Action.Type.move)
        {
            actionBubble.SetActive(false);
            if (isIdle)
            {
                directionAnimations = idleDirectionAnimations;
            }
            else
            {
                directionAnimations = runDirectionAnimations;
            }
        }
        else if (actionType == Action.Type.plant)
        {
            directionAnimations = runDirectionAnimations;
            actionBubble.SetActive(true);
            actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString());
        }
        else if (actionType == Action.Type.water)
        {
            directionAnimations = runDirectionAnimations;
            actionBubble.SetActive(true);
            actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString());
        }
        else if (actionType == Action.Type.pick)
        {
            directionAnimations = runDirectionAnimations;
            actionBubble.SetActive(true);
            actionIcon.sprite = Resources.Load <Sprite>(actionType.ToString());
        }
        int directionIndex = DirectionToIndex(direction, 8);

        //tell the animator to play the requested state
        animator.Play(directionAnimations[directionIndex]);
    }
コード例 #22
0
 public Action GetActionByType(Action.Type actionType)
 {
     return(actionTable[actionType]);
 }
コード例 #23
0
 public void ChangeWalls(Action.Type actionType, int changeValue)
 {
     Change(ref walls, actionType, changeValue);
     OnChange(CollectionType.WALL, actionType, walls, changeValue);
 }
コード例 #24
0
 public void ChangeShakes(Action.Type actionType, int changeValue)
 {
     Change(ref shakes, actionType, changeValue);
     OnChange(CollectionType.SHAKE, actionType, shakes, changeValue);
 }
コード例 #25
0
 public void ChangePrizes(Action.Type actionType, int changeValue)
 {
     Change(ref prizes, actionType, changeValue);
     OnChange(CollectionType.PRIZE, actionType, prizes, changeValue);
 }
コード例 #26
0
 public void ChangeCoins(Action.Type actionType, int changeValue)
 {
     Change(ref coins, actionType, changeValue);
     OnChange(CollectionType.COIN, actionType, coins, changeValue);
 }
コード例 #27
0
 public void newAction(Action.Priority priority, Action.Type type)
 {
     _actionQueue.Add(new Action(priority, type));
 }
コード例 #28
0
        public override bool LoadProtoBuf(BehaviorPB.Node node)
        {
            if (!base.LoadProtoBuf(node))
                return false;

            if (node.action == null)
                return false;

            scriptPath = node.action.script_path;
            actionType = (Action.Type)Type;
            return true;
        }
コード例 #29
0
 public void SetAction(Action.Type type)
 {
     ActionManager.SetAction(ref this.pAction, type);
     Debug.Assert(this.pAction != null);
 }
コード例 #30
0
 public int IncreaseExperience(Action.Type action)
 {
     return(Experience += (int)action);
 }
コード例 #31
0
 public ActionArgs(string source, Action.Type type)
 {
     Source = source;
     Type   = type;
 }