public void Initialize(Town town, long id, FixVector3 pos, bool simulate) { type = LogicUnitType.Demolisher; owner = DataManager.GetInstance().GetPlayerId() == town.id; this.id = id; this.town = town; mark = town.mark; position = pos; transform.position = pos.vector3; bornPosition = pos; InitializedData(); pathAgent.SetPathType(moveMode); pathAgent.SetPosition(position); InitializeOwner(simulate); debuffHandler = new DebuffHandler(); buffHandler = new BuffHandler(); fsmIdle = new DemolisherFsmIdle(this); fsmWalk = new DemolisherFsmWalk(this); fsmChase = new DemolisherFsmChase(this); fsmFight = new DemolisherFsmFight(this); fsmDying = new DemolisherFsmDying(this); fsmDead = new DemolisherFsmDead(this); fsmPlaceHolder = new DemolisherFsmPlaceHolder(this); currentFsm = fsmIdle; ChangeState(DemolisherState.IDLE, fsmIdle); DebugUtils.Log(DebugUtils.Type.AI_Demolisher, string.Format(" Initialize demolisher, born position = {0} ", pos)); }
public void Initialize(long id, NpcData proto, FixVector3 p, FixVector3 r) { this.id = id; type = LogicUnitType.NPC; position = p; transform.position = p.vector3; transform.rotation = Quaternion.Euler(r.vector3); brithPosition = p; brithDirection = r; hurtType = AttackPropertyType.PhysicalAttack; npcProto = proto; iconId = -1; metaId = proto.ID; modelId = proto.ModelID; 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 = ConvertUtils.ToLogicInt(proto.Speed); healthRegen = proto.HealthRegen; maxHp = proto.Health; chaseArea = ConvertUtils.ToLogicInt(proto.TargetDetectRange); maxChaseDistance = ConvertUtils.ToLogicInt(proto.MaxChaseDistance); emberOutPut = proto.EmberOutPut; projectileId = proto.ProjectileId; attackRange = ConvertUtils.ToLogicInt(proto.AttackRange); killReward = proto.KillReward; attackDuration = ConvertUtils.ToLogicInt(proto.AttackDuration); attackHitTime = ConvertUtils.ToLogicInt(proto.AttackHitDuration); fightInterval = 1; hp = maxHp; damage = physicasAttack; healthRecoverInterval = GameConstants.HP_RECOVERY_INTERVAL_MILLISECOND; InitializeState(); InitializePathAgent(); debuffHandler = new DebuffHandler(); buffHandler = new BuffHandler(); state = NpcState.IDLE; currentFsm = fsmIdle; }
public override void Attach(LogicUnit g, LogicUnit t) { DebugUtils.Log(DebugUtils.Type.AI_AttributeEffect, string.Format("{0} {1} has been attached a {2} {3} {4} to {5} mark unit {6}", g.type, g.id, type, attributeAffectType, metaId, t.mark, t.id)); state = AttributeEffectState.StartRelease; giver = g; taker = t; // owner will always be taker... owner = taker; if (t.type == LogicUnitType.Soldier) { Soldier s = (Soldier)taker; ownerBuff = s.buffHandler; } else if (t.type == LogicUnitType.NPC) { Npc n = (Npc)taker; ownerBuff = n.buffHandler; } else if (t.type == LogicUnitType.Demolisher) { Demolisher d = (Demolisher)taker; ownerBuff = d.buffHandler; } else if (t.type == LogicUnitType.CrystalCar) { CrystalCar c = (CrystalCar)taker; ownerBuff = c.buffHandler; } else { DebugUtils.LogWarning(DebugUtils.Type.AI_AttributeEffect, string.Format("{0} {1} can't handle {2} now!", t.type, t.id, attributeAffectType)); } if (ownerBuff != null && effectResId != 0) { RenderMessage rm = new RenderMessage(); rm.type = RenderMessage.Type.AttachAttributeEffect; rm.ownerId = id; rm.arguments.Add("HolderType", (int)t.type); rm.arguments.Add("HolderId", t.id); rm.arguments.Add("resId", effectResId); rm.arguments.Add("bindPointName", effectBindPoint); PostRenderMessage(rm); } }
public void Initialize(Town town, long id, FixVector3 pos, bool simulate) { type = LogicUnitType.CrystalCar; this.id = id; this.town = town; mark = town.mark; position = pos; transform.position = pos.vector3; bornPosition = pos; InitializedData(); if (pathAgent != null) { pathAgent.SetPathType(moveMode); pathAgent.SetPosition(position); } InitializeOwner(simulate); debuffHandler = new DebuffHandler(); buffHandler = new BuffHandler(); fsmIdle = new CrystalCarFsmIdle(this); fsmWalk = new CrystalCarFsmWalk(this); fsmChase = new CrystalCarFsmChase(this); fsmMining = new CrystalCarFsmMining(this); fsmDying = new CrystalCarFsmDying(this); fsmDead = new CrystalCarFsmDead(this); fsmPlaceHolder = new CrystalCarFsmPlaceHolder(this); currentFsm = fsmIdle; ChangeState(CrystalCarState.IDLE, fsmIdle); DebugUtils.Log(DebugUtils.Type.AI_CrystalCar, string.Format(" Initialize crystal car, born position = {0} ", pos)); }