Esempio n. 1
0
 private void SetAndCallActions(BirdMisc current, BirdMisc next, params ActionTypeCollction[] types)
 {
     Action[] actions = new Action[types.Length];
     for (var i = 0; i < types.Length; i++)
     {
         ActionTypeCollction typeCollction = types[i];
         Action action = () => {
             current.SetSprite(typeCollction.GetTypes()[0]);
             next.SetSprite(typeCollction.GetTypes()[1]);
         };
         actions[i] = action;
     }
     soundAudioSource.PlayOneShot(clickClip);
     StartCoroutine(DoActions(actions));
 }
Esempio n. 2
0
    public void SendLetter(GameObject target)
    {
        IsClickable      = false;
        clickedCharacter = target.transform;
        bool     isTargetOnRight = clickedCharacter.position.x > currentCharacter.position.x;
        bool     isTargetOnLeft  = clickedCharacter.position.x < currentCharacter.position.x;
        bool     isTargetOnUp    = clickedCharacter.position.y > currentCharacter.position.y;
        bool     isTargetOnDown  = clickedCharacter.position.y < currentCharacter.position.y;
        BirdMisc nextBirdMisc    = _spawnManager.GetBirdMisc(target);
        BirdMisc currentbirdMisc = _spawnManager.GetBirdMisc(currentCharacter.gameObject);

        ActionTypeCollction[] typeCollctions = new ActionTypeCollction[3];
        if (isTargetOnRight)
        {
            typeCollctions[0] = new ActionTypeCollction(ActionType.SendRight, ActionType.RaiseLeftHand);
            typeCollctions[1] = new ActionTypeCollction(ActionType.RaiseRightHand, ActionType.SendLeft);
        }
        else if (isTargetOnLeft)
        {
            typeCollctions[0] = new ActionTypeCollction(ActionType.SendLeft, ActionType.RaiseRightHand);
            typeCollctions[1] = new ActionTypeCollction(ActionType.RaiseLeftHand, ActionType.SendRight);
        }
        else if (isTargetOnUp)
        {
            typeCollctions[0] = new ActionTypeCollction(ActionType.SendForward, ActionType.RaiseBackHand);
            typeCollctions[1] = new ActionTypeCollction(ActionType.RaiseForwardHand, ActionType.SendBack);
        }
        else if (isTargetOnDown)
        {
            typeCollctions[0] = new ActionTypeCollction(ActionType.SendBack, ActionType.RaiseForwardHand);
            typeCollctions[1] = new ActionTypeCollction(ActionType.RaiseBackHand, ActionType.SendForward);
        }

        typeCollctions[2] = new ActionTypeCollction(ActionType.Idle, ActionType.Idle);
        SetAndCallActions(currentbirdMisc, nextBirdMisc, typeCollctions);
    }