예제 #1
0
        public override void Reset()
        {
            target   = null;
            state    = IdolGuardState.NONE;
            targetId = 0;

            // TODO: add more reset code
        }
예제 #2
0
        public void ChangeState(IdolGuardState s, Fsm fsm)
        {
            DebugUtils.Assert(fsm != null, "Can't translate to a null npc state!");

            currentFsm.OnExit();
            currentFsm = fsm;
            state      = s;

            DebugUtils.LogWarning(DebugUtils.Type.AI_Npc, string.Format("{0} {1} enter {2} state", npcType, id, state));
            currentFsm.OnEnter();
        }
예제 #3
0
        public void Initialize(long id, NpcData proto, FixVector3 p, FixVector3 r)
        {
            this.id = id;

            type = LogicUnitType.IdolGuard;

            position           = p;
            transform.position = p.vector3;
            brithPosition      = p;
            brithDirection     = r;
            hurtType           = AttackPropertyType.PhysicalAttack;

            npcProto         = proto;
            metaId           = proto.ID;
            modelId          = proto.ModelID;
            iconId           = -1;
            modelRadius      = ConvertUtils.ToLogicInt(proto.ModelRadius);
            npcType          = (NpcType)proto.NPCType;
            attackType       = (NpcAttackType)proto.StandardAttack;
            rebornInterval   = ConvertUtils.ToLogicInt(proto.RebornInterval);
            physicasAttack   = (int)proto.PhysicsAttack;
            armor            = (int)proto.Armor;
            magicResist      = (int)proto.MagicResist;
            speedFactor      = proto.Speed;
            healthRegen      = proto.HealthRegen;
            maxHp            = proto.Health;
            chaseArea        = ConvertUtils.ToLogicInt(proto.TargetDetectRange);
            maxChaseDistance = ConvertUtils.ToLogicInt(proto.MaxChaseDistance);
            emberOutPut      = proto.EmberOutPut;
            projectileId     = 1 /*proto.ProjectileId*/;
            attackRange      = ConvertUtils.ToLogicInt(proto.AttackRange);
            fightInterval    = ConvertUtils.ToLogicInt(1);

            hp     = maxHp;
            damage = physicasAttack;

            InitializeState();

            state      = IdolGuardState.IDLE;
            currentFsm = fsmIdle;
            ChangeState(IdolGuardState.IDLE, fsmIdle);
        }