Example #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);
    }
Example #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??
    }
Example #3
0
    public override void ProcessPlayingInputs(float horizontal, float vertical, float switchblock, bool placeblock, bool jump, Vector3 courseAdjust, Vector3 fineAdjust, Vector3 mousePosition)
    {
        if (switchblock >= 0.1f)
        {
            BlocksUI.RotateBlocksRight();

            //set active block type in block place manager to match what's showing in the UI
            BlockTypes active = BlocksUI.ActiveBlockType();
            BlockPlacer.SetSelectedBlockType(active);
        }
        else if (switchblock <= -0.1f)
        {
            BlocksUI.RotateBlocksLeft();

            //set active block type in block place manager to match what's showing in the UI
            BlockTypes active = BlocksUI.ActiveBlockType();
            BlockPlacer.SetSelectedBlockType(active);
        }

        //z = 0 when that input type is being used
        if (mousePosition.z == 0)
        {
            Vector2 world = Camera.main.ScreenToWorldPoint(mousePosition);
            BlockPlacer.SetBlockCursorPosition(world);
        }
        else
        {
            if (courseAdjust.z == 0)
            {
            }
            else if (fineAdjust.z == 0)
            {
            }
        }

        if (placeblock && !BlockPlacer.InBlockPlaceMode)
        {
            compositeCamera.enabled = true;
            prepassCamera.gameObject.SetActive(true);
            BlockPlacer.BeginBlockPlaceMode();
        }
        else if (!placeblock && BlockPlacer.InBlockPlaceMode)
        {
            BlockPlacer.EndBlockPlaceMode();
        }

        //player movement
        Player.InputDirection = new Vector2(horizontal, vertical);
        Player.ProcessJumpInput(jump);
    }