Beispiel #1
0
    public void UpdateState()
    {
        //Check arrive at box
        if (hiding == false)
        {
            if (barion.DstArrived())
            {
                Hide();
            }
        }
        else
        {                                                                                                                             //Actually hiding
            barion.transform.position = new Vector3(box.transform.position.x, barion.transform.position.y, box.transform.position.z); //Update position with box

            if (barion.is_selected)
            {
                if (barion.GetMovement(ref destination)) //Get movement input
                {
                    GetOut();                            //Get out the box
                }
            }
        }
    }
    public void UpdateState()
    {
        //Check arrive destination
        if (barion.DstArrived())
        {
            ToIdleState();
        }

        //Actions performed when Barion is selected
        if (barion.is_selected)
        {
            //Check new input movement
            if (barion.GetMovement(ref destination))
            {
                ToWalkingState();
            }

            //Can transition to moving box
            if (barion.target_box != null)
            {
                ToMoveBoxState();
            }

            if (Input.GetAxis("Ability1") != 0 && barion.cooldown_inst.AbilityIsReady(1))
            {
                ToInvisibleSphereState();
                return;
            }

            //Invisible sphere ability (ability1)
            if (Input.GetAxis("Ability2") != 0 && barion.cooldown_inst.AbilityIsReady(2))
            {
                ToShieldState();
                return;
            }
        }
    }