Beispiel #1
0
    void ClearBlock(GameBlock block, bool score)
    {
        if (block == SelectedBlock)
        {
            SelectBlock(null, null);
        }
        if (block.IsAnimating)
        {
            CurrentState = GameState.Selecting;
        }

        if (score)
        {
            // Collect Powerups
            if (block.PowerupId.HasValue)
            {
                if (block.PowerupId.Value == GameBlock.Powerup.BoardClear)
                {
                    Flier.Spawn(block.PowerupSprite, block.transform.position, BoardClearTransform.position, BoardClearTransform.gameObject, 1, Flier.AudioToPlay.ItemCollect);
                }
                else if (block.PowerupId.Value == GameBlock.Powerup.TimeStop)
                {
                    Flier.Spawn(block.PowerupSprite, block.transform.position, TimeStopTransform.position, TimeStopTransform.gameObject, 1, Flier.AudioToPlay.ItemCollect);
                }
            }

            Flier.Spawn(block.BlockSprite, block.transform.position, ScoreTransform.position, ScoreTransform.gameObject,
                        (collector.Count > 3) ? ScorePerBlock * (collector.Count - 2) : ScorePerBlock, Flier.AudioToPlay.BlockCollect
                        );
        }

        CloudPuff.Spawn(block.transform.position);
        GameBlock.Despawn(block);
    }
Beispiel #2
0
    public static Flier Spawn(Sprite sprite, Vector3 originalPos, Vector3 targetPos, GameObject targetObject, int number, AudioToPlay?audio)
    {
        tmp = null;

        // Attempt to use a pooled object
        for (int i = 0; i < Pool.Count; i++)
        {
            if (Pool[i] != null && !Pool[i].gameObject.activeSelf)
            {
                tmp = Pool[i];
                tmp.gameObject.SetActive(true);
                tmp.InitializeFromPool(sprite, originalPos, targetPos, targetObject, number, audio);
                return(tmp);
            }
        }

        // Create a new object
        tmp = (Flier)Instantiate(prefab);
        tmp.InitializeFromPool(sprite, originalPos, targetPos, targetObject, number, audio);
        Pool.Add(tmp);
        return(tmp);
    }
Beispiel #3
0
 public static void Despawn(Flier flier)
 {
     flier.gameObject.SetActive(false);
 }
Beispiel #4
0
 public Swallow()
 {
     flier   = new Flier(PrintScheduleInfo);
     builder = new Builder(PrintScheduleInfo);
 }