Esempio n. 1
0
    public void FillBlocks()
    {
        for (int i = 0; i < 3; i++)
        {
            SpawnNewBlock(i);
        }

        topBlock = iceBlocks[0].GetComponent <IceBlockBehaviour>();
    }
Esempio n. 2
0
    public void ClearBlocks()
    {
        topBlock = null;

        for (int i = 0; i < 3; i++)
        {
            Destroy(iceBlocks[i]);
        }
    }
Esempio n. 3
0
    public void HandleBrokenBlock()
    {
        MoveUpBlocks();
        topBlock = iceBlocks[0].GetComponent <IceBlockBehaviour>();
        SpawnNewBlock(2);

        ScoreBehaviour.AddPoints(1);

        GameSpeed.IncreaseSpeed();
    }
    void DigFromSide(BearSide side)
    {
        IceBlockBehaviour activeBlock = IceBlockManagerBehaviour.topBlock;

        switch (side)
        {
        case BearSide.Left:
            activeBlock.SendMessage("TakeHitFromLeft");
            break;

        case BearSide.Right:
            activeBlock.SendMessage("TakeHitFromRight");
            break;

        case BearSide.Both:
            activeBlock.SendMessage("TakeHitFromBoth");
            break;

        default:
            Debug.Log("Bear attempted to dig from impossible side");
            break;
        }
    }
Esempio n. 5
0
    void Start()
    {
        slots = new Transform[3] {
            transform.GetChild(0), transform.GetChild(1), transform.GetChild(2)
        };
        //instantiate three blocks
        GameObject top, middle, bottom;

        top    = Instantiate(toSpawn, slots[0]);
        middle = Instantiate(toSpawn, slots[1]);
        bottom = Instantiate(toSpawn, slots[2]);

        iceBlocks = new GameObject[3] {
            top, middle, bottom
        };

        if (top.GetComponent <IceBlockBehaviour>() != null)
        {
            topBlock = iceBlocks[0].GetComponent <IceBlockBehaviour>();
        }

        //set reference in GameStateManager
        GameStateManager.blockManager = this;
    }