Exemplo n.º 1
0
    public void Paint()
    {
        //Check if a block is hit
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, RaycastMask))
        {
            Block block = hit.transform.GetComponentInParent <Block>();

            Tracker = new PaintTracker(block.Colour);
            ActionManager.AddAction(Tracker);

            block.Paint(CurrentColour);
            Tracker.AddBlock(block);

            StartCoroutine(_Painting());
        }
    }
Exemplo n.º 2
0
    IEnumerator _Painting()
    {
        Painting = true;
        while (Active && Joycons.A)
        {
            //Check if a block is hit
            RaycastHit hit;
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, RaycastMask))
            {
                Block block = hit.transform.GetComponentInParent <Block>();

                block.Paint(CurrentColour);
                Tracker.AddBlock(block);
            }

            yield return(null);
        }

        Painting = false;
    }