예제 #1
0
    public void Start()
    {
        StartTime = Time.time;

        //Get Handle to Camera Effect Classes
        compositeCamera = Camera.main.GetComponent <OutlineComposite>();
        prepassCamera   = Camera.main.GetComponentInChildren <OutlinePrePass>();

        //Fade in for beginning of level
        StartCoroutine(FadeViewIn());

        //Get Handle to BlockPlacer
        BlockPlacer = GetComponent <BlockPlaceManager>();

        BlockPlacer.BlocksPlacedEventHandler += BlocksUI.c_newBlockPlacedEvent;
        BlockPlacer.BlocksPlacedEventHandler += this.c_newBlockPlacedEvent;

        //set BlockPlacer Starting Block Counts
        BlockPlacer.AddAvailableBlocks(BlockTypes.Clay, 5);
        BlockPlacer.AddAvailableBlocks(BlockTypes.Dirt, 5);
        BlockPlacer.AddAvailableBlocks(BlockTypes.Steel, 5);
        BlockPlacer.AddAvailableBlocks(BlockTypes.Clay, 20);
        BlockPlacer.AddAvailableBlocks(BlockTypes.Cloud, 1);

        //set Block UI Starting Block Counts
        //these ones are for testing...make sure to remove
        BlocksUI.AddBlocks(BlockTypes.Clay, 5);
        BlocksUI.AddBlocks(BlockTypes.Dirt, 5);
        BlocksUI.AddBlocks(BlockTypes.Steel, 5);
        BlocksUI.AddBlocks(BlockTypes.Clay, 20);
        BlocksUI.AddBlocks(BlockTypes.Cloud, 1);
    }
예제 #2
0
    public void c_newBlockGatheredEvent(object sender, BlockGatheredEventInfo e)
    {
        //update UI
        BlocksUI.AddBlocks(e.Type, e.Count);

        //Update Block Placement Manager
        BlockPlacer.AddAvailableBlocks(e.Type, e.Count);

        //Update LevelStats
        currentStats.BlocksCollected += e.Count;

        //Verify UI and Block Placement Manager are in sync??
    }