useTargetSkill() public method

public useTargetSkill ( Int32 skillID, Int32 targetID ) : int
skillID System.Int32
targetID System.Int32
return int
コード例 #1
0
ファイル: UI_Game.cs プロジェクト: behiever/kbengineTestGame
    public void AttackSkill(int skillId)
    {
        KBEngine.Entity entity = KBEngineApp.app.player();
        KBEngine.Avatar avatar = null;
        if (entity != null && entity.className == "Avatar")
        {
            avatar = (KBEngine.Avatar)entity;
        }
        if (avatar == null)
        {
            return;
        }

        UI_Target ui_target = World.instance.getUITarget();

        if (ui_target != null && ui_target.GE_target != null)
        {
            string name     = ui_target.GE_target.name;
            Int32  entityId = Utility.getPostInt(name);

            if (avatar != null)
            {
                int errorCode = avatar.useTargetSkill(skillId, entityId);
                if (errorCode == 1)
                {
                    UI_ErrorHint._instance.errorShow("目标太远");
                    //逼近目标
                    UnityEngine.GameObject renderEntity = (UnityEngine.GameObject)entity.renderObj;
                    renderEntity.GetComponent <MoveController>().moveTo(ui_target.GE_target.transform, SkillBox.inst.get(skillId).canUseDistMax - 1, skillId);
                }
                if (errorCode == 2)
                {
                    UI_ErrorHint._instance.errorShow("技能冷却");
                }
                if (errorCode == 3)
                {
                    UI_ErrorHint._instance.errorShow("目标已死亡");
                }
            }
        }
        else
        {
            if (skillId == 3)//治疗自己
            {
                if (avatar != null)
                {
                    int errorCode = avatar.useTargetSkill(skillId, avatar.id);
                    if (errorCode == 2)
                    {
                        UI_ErrorHint._instance.errorShow("技能冷却");
                    }
                    if (errorCode == 3)
                    {
                        UI_ErrorHint._instance.errorShow("目标已死亡");
                    }
                }
            }
            else
            {
                UI_ErrorHint._instance.errorShow("未选择目标");
            }
        }
    }