void Move() { if (target != null && damageType == 2) { Vector3 dir = tran.position; dir.y = target.transform.position.y; dir = dir - target.transform.position; Quaternion rot = Quaternion.LookRotation(dir, Vector3.up); tran.rotation = rot; } frameDis = Time.deltaTime * speed; tran.Translate(Vector3.forward * frameDis); if (disappearType == 1) { maxDis -= frameDis; if (maxDis <= 0) { //TODO:消失 inited = false; DestroyMe(); } } }
//默认的初始化方式 void defaultInit(NPCConfigData cfg) { this.lv = 1; this.num = cfg.ID; this.curHp = cfg.healthpoint; this.totalConstHp = cfg.healthpoint; this.totalTempHp = cfg.healthpoint; this.attackpower = cfg.attackpower; this.armorclass = cfg.armorclass; this.armorpenetration = cfg.armorpenetration; this.spellpower = cfg.spellpower; this.spellresistance = cfg.spellresistance; this.spellpenetration = cfg.spellpenetration; this.attackdamagereduction = cfg.attackdamagereduction; this.spelldamagereduction = cfg.spelldamagereduction; this.speed = cfg.speed; this.crit = cfg.crit; this.BeHeal = cfg.BeHeal; this.critresistance = cfg.critresistance; this.additionalcrit = cfg.additionalcrit; this.attacklifesteal = cfg.attacklifesteal; this.spelllifesteal = cfg.spelllifesteal; this.attackspeed = cfg.attackspeed; this.additionalreduction = cfg.additionalreduction; this.attackdamageback = cfg.attackdamageback; this.spelldamageback = cfg.spelldamageback; this.recovery = cfg.recovery; this.attackadditionaldamage = cfg.attackadditionaldamage; this.Protection = 0f; this.factor = cfg.factor; this.seekRange = cfg.seekRange; this.fleeRange = cfg.fleeRange; }
// Update is called once per frame public void Update() { if (inited) { lifeTime -= Time.deltaTime; if (lifeTime < 0f) { inited = false; WarTarAnimParam deadParam = new WarTarAnimParam(); deadParam.OP = EffectOp.Injury; SelfDescribed des = new SelfDescribed() { src = UniqueID, target = UniqueID, act = Verb.Punch, srcEnd = null, targetEnd = new EndResult() { param1 = 9999999, param2 = 0, param3 = 0, param4 = 0, }, }; deadParam.described = des; deadParam.Sender = UniqueID; deadParam.Receiver = UniqueID; wmMgr.npcMgr.SendMessage(UniqueID, UniqueID, deadParam); } } }
public float getFloatValue(string FieldName) { FieldInfo fi = GetType().GetField(FieldName, c_bf); if (fi.FieldType == typeof(Int32Fog)) { Int32Fog val = (Int32Fog)fi.GetValue(this); return(val.toInt32()); } else { FloatFog val = (FloatFog)fi.GetValue(this); return(val); } }
// Update is called once per frame public void Update() { if (inited) { lifeTime -= Time.deltaTime; if (lifeTime < 0f) { inited = false; if (onEnd != null) { onEnd(this); } DestroyMe(); } } }
public override void Init(ServerNPC owner, WarMsgParam param) { parent = owner; ConsoleEx.DebugLog(parent.name); wmMgr = WarServerManager.Instance; UniqueId = wmMgr.npcMgr.SignID(this); Camp = Camp.set(owner.Camp); WarSrcAnimParam wp = param as WarSrcAnimParam; if (wp != null) { SelfDescribed sd = wp.described; EndResult result = sd.srcEnd; lifeTime = result.param8; } inited = true; }
/// <summary> /// Init the specified owner and param. /// </summary> /// <param name="owner">Owner.</param> /// <param name="param">Parameter.</param> public override void Init(ServerNPC owner, WarMsgParam param) { parent = owner; tran = transform; wmMgr = WarServerManager.Instance; Camp = Camp.set(parent.Camp); WarSrcAnimParam srcParam = param as WarSrcAnimParam; if (srcParam != null) { SelfDescribed sd = srcParam.described; if (sd != null) { EndResult result = sd.targetEnd; int effectIndex = result.param2; targetIndex = result.param5; if (targetIndex > 0) { if (wmMgr != null) { target = wmMgr.npcMgr.GetNPCByUniqueID(targetIndex); } } EffectConfigData effect = Core.Data.getIModelConfig <EffectModel>().get(effectIndex); if (effect != null) { effectID = effectIndex; speed = effect.Param3 / 1000f; maxDis = effect.Param4 / 1000; damageType = effect.Param8; disappearType = effect.Param5; } // string msg = string.Format("[effect:{0} speed:{1} maxDis:{2} disappearType:{3} damageType:{4}]", effectID, speed, maxDis, disappearType, damageType); // Debug.Log(msg); } inited = true; } }
// Use this for initialization void Start() { FloatFog j = i + 0.3f; ConsoleEx.DebugLog(j.ToString()); }