예제 #1
0
        private void Update()
        {
            if (m_ActionState.ActionState != ActionCode.Idle)
            {
                return;
            }

            if (Input.GetButtonDown("AutoAttack"))
            {
                var mousePoint = InputExtension.GetMouseHitGroundPoint();
                if (mousePoint == null)
                {
                    return;
                }
                var forwardVec = mousePoint.Value - transform.position;
                forwardVec = forwardVec.normalized;
                RequestAutoAttack(forwardVec);
            }

            if (PerformContinueAAs && m_ContinueAutoAttack)
            {
                if (!TargetInRange())
                {
                    m_ContinueAutoAttack = false;
                    return;
                }

                var forwardVec = GameData.Target.transform.position - transform.position;
                forwardVec = forwardVec.normalized;
                RequestAutoAttack(forwardVec);
            }
        }
예제 #2
0
    private void SkillCalled(ActionCode skill)
    {
        // TODO: Refactor with strategy pattern.

        //No target skills
        switch (skill)
        {
        case ActionCode.Dash:
            RequestOperations.DashRequest();
            break;

        case ActionCode.HammerBash:
            var hbAction = new Action(() => CastSkill(skill, Vector3.back, 1f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, hbAction);
            RequestOperations.HammerBashRequest();
            break;
        }

        //Character target skills
        switch (skill)
        {
        case ActionCode.DistractingShot:
            var mousePoint = InputExtension.GetMouseHitGroundPoint();
            if (mousePoint == null)
            {
                return;
            }

            var forwardVec = mousePoint.Value - m_Player.transform.position;
            forwardVec = forwardVec.normalized;
            var dsAction = new Action(() => CastSkill(skill, mousePoint.Value, 0.5f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, dsAction);
            RequestOperations.DistractingShotRequest(forwardVec);
            break;

        case ActionCode.OrisonOfHealing:
            if (GameData.Target != null || m_TargetSelector.SetTarget())
            {
                var oohAction = new Action(() => CastSkill(skill, GameData.Target.transform.position, 1f));
                ResponseOperations.AddActionToResponseWaitinglist(skill, oohAction);
                RequestOperations.OrisonOfHealingRequest(GameData.Target.name);
                //CastSkill(skill, GameData.Target.transform.position, 1f);
            }
            break;
        }

        //Mouse position as target skills
        switch (skill)
        {
        case ActionCode.FireStorm:
            var mousePoint = InputExtension.GetMouseHitGroundPoint();
            if (mousePoint == null)
            {
                return;
            }

            var action = new Action(() => CastSkill(skill, mousePoint.Value, 2f));
            ResponseOperations.AddActionToResponseWaitinglist(skill, action);
            RequestOperations.FireStormRequest(mousePoint.Value);
            break;
        }
    }