protected override void Update() { base.Update(); animator.SetBool("POWER", power); if (action) { if (power) { Illusion illusionInstance = Instantiate(illusionPrefab.gameObject, origin.position, Quaternion.identity).GetComponent <Illusion>(); if (moveSpeed == 0) { illusionInstance.InitialKick(transform.right); } else { illusionInstance.InitialKick(transform.up * moveSpeed + transform.right); } AkSoundEngine.PostEvent("sfx_djinn_power", gameObject); Instantiate(wishPrefab, origin.position, transform.rotation); charges -= chargesRequired; power = false; action = false; if (UpdateCharges != null) { UpdateCharges(charges); } } } }
void StartGlide() { Force.BackForce(this.gameObject, host.DirectionCurrent, speed, time); Illusion.Create(this.GetComponent <SpriteRenderer>(), time, (int)(speed * density)); host.LockMove.Register(codeSkill); host.LockAttack.Register(codeSkill); host.LockColliderTakeDamage.Register(codeSkill); Invoke("SkillComplete", time); }
public IllusionManager() { GetIllusions = new List <Illusion>(); ObjectManager.OnAddEntity += args => { DelayAction.Add(150, () => { var hero = args.Entity as Hero; if (hero == null || !hero.IsIllusion || hero.Team != Core.MainHero.Hero.Team || !hero.IsControllable || hero.HasModifier("modifier_kill")) { return; } Printer.Both("added illusion: " + hero.Name); var ill = new Illusion(hero); ill.Init(); GetIllusions.Add(ill); }); }; Entity.OnInt32PropertyChange += (sender, args) => { var hero = sender as Hero; if (hero == null || !hero.IsIllusion) { return; } if (args.PropertyName != "m_iHealth") { return; } if (args.NewValue == 0) { var target = GetIllusions.Find(x => x.Hero.Equals(hero)); if (target != null) { target.Orbwalker.Unload(); GetIllusions.Remove(target); Printer.Both("removed illusion: " + hero.Name); } else { } } }; }
private Illusion LoadIllusionFromXml(SecurityElement element) { Illusion illusion = new Illusion { Id = StrParser.ParseHexInt(element.Attribute("Id"), 0), ContinueTime = StrParser.ParseDecInt(element.Attribute("ContinueTime"), 0), ModelId = StrParser.ParseHexInt(element.Attribute("ModelId"), 0), GetWay = StrParser.ParseStr(element.Attribute("GetWay"), ""), ModifierSetDesc = StrParser.ParseStr(element.Attribute("ModifierSetDesc"), "", true), SortIndex = StrParser.ParseDecInt(element.Attribute("SortIndex"), 0), IllusionPower = StrParser.ParseFloat(element.Attribute("IllusionPower"), 0f) }; if (element.Children != null) { foreach (SecurityElement element2 in element.Children) { PropertyModifier modifier; string tag = element2.Tag; if (tag != null) { if (tag != "Cost") { if (tag == "PropertyModifier") { goto Label_011E; } if (tag == "DanAttributeId") { goto Label_0133; } } else { illusion.ActivateCost = Cost.LoadFromXml(element2); } } continue; Label_011E: modifier = PropertyModifier.LoadFromXml(element2); illusion.IllusionModifers.Add(modifier); continue; Label_0133: illusion.DanAttributeIds.Add(StrParser.ParseHexInt(element2.Text, 0)); } } return(illusion); }