Exemplo n.º 1
0
 public UnitSetting(JSON_MapPartyUnit json)
 {
     this.uniqname          = (OString)json.name;
     this.ai                = (OString)json.ai;
     this.pos.x             = (OInt)json.x;
     this.pos.y             = (OInt)json.y;
     this.dir               = (OInt)json.dir;
     this.waitEntryClock    = (OInt)json.wait_e;
     this.waitMoveTurn      = (OInt)json.wait_m;
     this.waitExitTurn      = (OInt)json.wait_exit;
     this.startCtCalc       = (eMapUnitCtCalcType)json.ct_calc;
     this.startCtVal        = (OInt)json.ct_val;
     this.DisableFirceVoice = json.fvoff != 0;
     this.side              = (OInt)0;
     this.ai_type           = (AIActionType)json.ai_type;
     this.ai_pos.x          = (OInt)json.ai_x;
     this.ai_pos.y          = (OInt)json.ai_y;
     this.ai_len            = (OInt)json.ai_len;
     this.parent            = (OString)json.parent;
     if (json.trg != null)
     {
         this.trigger = new EventTrigger();
         this.trigger.Deserialize(json.trg);
     }
     if (json.entries == null || json.entries.Length <= 0)
     {
         return;
     }
     this.entries     = new List <UnitEntryTrigger>((IEnumerable <UnitEntryTrigger>)json.entries);
     this.entries_and = (OInt)json.entries_and;
 }
Exemplo n.º 2
0
        private List <AIAction> getAIActions(BattleGame game, AIActionType type)
        {
            List <AIAction> retvalList = new List <AIAction>();

            switch (type)
            {
            case AIActionType.Attack:
                retvalList.AddRange(getAIAttackActions(game));
                break;

            case AIActionType.RangedAttack:
                retvalList.AddRange(getAIRangedAttackActions(game));
                break;

            case AIActionType.Heal:
                retvalList.AddRange(getAIHealActions(game));
                break;

            default:
                break;
            }

            //Remove any actions that cost too much AP
            for (int i = retvalList.Count - 1; i >= 0; i--)
            {
                int apCost = retvalList[i].battleActionList.Sum(x => x.AP);
                if (apCost > game.ActiveCharacter.ap)
                {
                    retvalList.RemoveAt(i);
                }
            }

            return(retvalList);
        }
Exemplo n.º 3
0
    public virtual BTResult DoAction(AIActionType type)
    {
        switch (type)
        {
        case AIActionType.Idle:
        {
            entity.PlayAction(ActionEnum.free);
        }
        break;

        case AIActionType.Attack:
        {
            var skill = entity.GetReleasableSkill(SkillType.Automatic);

            entity.ReleaseSkill(skill);
        }
        break;

        case AIActionType.Die:
        {
            entity.data.target = 0;
            entity.PlayAction(ActionEnum.death);
        }
        break;

        case AIActionType.FindTarget:
        {
            entity.FindTarget();
        }
        break;
        }
        return(BTResult.Success);
    }
Exemplo n.º 4
0
    void InitAI()
    {
        if (mObj == null)
        {
            return;
        }

        int aiId = mObj.GetProperty("AI").GetInt();

        mCurAIProperty = XmlManager.Instance.GetAIProperty(aiId);
        if (mCurAIProperty == null)
        {
            return;
        }

        if (mCurAIProperty.mAIStageList == null)
        {
            return;
        }

        if (mCurAIProperty.mAIStageList.Count < 1)
        {
            return;
        }

        mCurAIActionType = mCurAIProperty.mAIStageList[0].mAIActionType;
    }
Exemplo n.º 5
0
        private List<AIAction> getAIActions(BattleGame game, AIActionType type)
        {
            List<AIAction> retvalList = new List<AIAction>();
            switch (type)
            {
                case AIActionType.Attack:
                    retvalList.AddRange(getAIAttackActions(game));
                    break;
                case AIActionType.RangedAttack:
                    retvalList.AddRange(getAIRangedAttackActions(game));
                    break;
                case AIActionType.Heal:
                    retvalList.AddRange(getAIHealActions(game));
                    break;
                default:
                    break;
            }

            //Remove any actions that cost too much AP
            for (int i = retvalList.Count - 1; i >= 0; i--)
            {
                int apCost = retvalList[i].battleActionList.Sum(x => x.AP);
                if (apCost > game.ActiveCharacter.ap)
                {
                    retvalList.RemoveAt(i);
                }
            }

            return retvalList;
        }
Exemplo n.º 6
0
    public override BTResult DoAction(AIActionType type)
    {
        base.DoAction(type);
        switch (type)
        {
        case AIActionType.Idle:
        {
            RotateToTarget();
        }
        break;

        case AIActionType.FindTarget:
        {
            RotateToTarget();
        }
        break;
        }
        //Debug.Log(GetType().Name + " "+data.id + " " + type.ToString());
        return(BTResult.Success);
    }
Exemplo n.º 7
0
    public override BTResult DoAction(AIActionType type)
    {
        base.DoAction(type);
        switch (type)
        {
        case AIActionType.MoveToPoint:
        {
            entity.PlayAction(ActionEnum.walk);
        }
        break;

        case AIActionType.Attack:
        {
            entity.LookAtTarget();
            // SetDestination(entity.position);
        }
        break;

        case AIActionType.Die:
        {
            needStop = true;
        }
        break;

        case AIActionType.FollowTarget:
        {
            FollowTarget();
        }
        break;
        }

        //if (data.id == 2)
        //{
        //   Debug.Log(GetType().Name + " " + type.ToString());
        //}
        return(BTResult.Success);
    }
Exemplo n.º 8
0
 public AIAction(AIActionType type)
 {
     this.type = type;
 }