Exemplo n.º 1
0
    public void PutIntoPool(GameObject go)
    {
        classMates.Add(go);

        BirdMisc birdMisc = new BirdMisc(go, BirdType.Sparrow);

        birdMisc.gameObject = go;
        birdMiscs.Add(birdMisc);
    }
Exemplo n.º 2
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));
 }
Exemplo n.º 3
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);
    }