Ejemplo n.º 1
0
    void KeyInput()
    {
        if (myUnit.GetCondition() != ConditionData.UnitCondition.none)
        {
            movement.Stop();
            return;
        }

        // Zoom IN
        if (myUnit.GetAction().IsUsingAction("ThrowHarpoon"))
        {
            if (myUnit.GetAction().behaviourState < 3)
            {
                if ((!Input.GetKey(KeyCode.Mouse1) || myUnit.currentWeapon.weaponName != "Harpoon"))
                {
                    /*camSpring.ChangeCamInfo("Player");
                     * zoomIn = false;*/
                    if (zoomIn)
                    {
                        camSpring.ChangeCamInfo("Player");
                        zoomIn = false;
                    }
                    myUnit.GetAction().StopAction();
                }
            }

            /*if (zoomIn && !movement.isOnGround)
             * {
             *  Time.timeScale = 0.3f;
             *  Time.fixedDeltaTime = 0.02F * Time.timeScale;
             * }
             * else
             * {
             *  Time.timeScale = 1f;
             *  Time.fixedDeltaTime = 0.02F * Time.timeScale;
             * }*/
        }
        else
        {
            if (myUnit.currentWeapon.weaponName == "Harpoon")
            {
                if (Input.GetKeyDown(KeyCode.Mouse1))
                {
                    if (myUnit.GetAction().UseSkill("ThrowHarpoon"))
                    {
                        camSpring.ChangeCamInfo("Player_Aim");
                        zoomIn = true;
                    }
                }
            }
            else if (harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
            {
                if (Input.GetKeyDown(KeyCode.Mouse1))
                {
                    myUnit.GetAction().UseSkill("PullHarpoon");
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {
            if (harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
            {
                myUnit.GetAction().UseSkill("HookShot", false);
            }
            else if (!zoomIn && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.NONE)
            {
                myUnit.GetAction().UseSkill("SwingWeapon");
            }
            else if (zoomIn && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.NONE)
            {
                myUnit.GetAction().UseSkill("ThrowHarpoon");
            }
        }
        MovementInput();
        if (Input.GetKey(KeyCode.E) && harpoonProjectile.harpoonState == PHarpoon.HARPOON_STATE.FIXED)
        {
            if (harpoonProjectile.fixedTarget.tag == "Monster")
            {
                SoulInfo soulInfo = harpoonProjectile.fixedTarget.GetComponent <SoulInfo>();
                if (soulInfo && soulInfo.IsAnEvil())
                {
                    myUnit.GetAction().UseSkill("HealingSoul", false);
                }
            }
        }
        if (Input.GetKeyDown(KeyCode.Space) && !myUnit.GetAction().IsUsingAction())
        {
            if (!movement.isOnGround)
            {
                if (myUnit.IsHaveBuff(BuffBehaviour.BuffType.Fly))
                {
                    myUnit.GetAction().UseSkill("Flying");
                }
            }
            else
            {
                movement.Jump(jumpPower);
            }
        }
    }