public Time(SkillGenerics skill) { skill.CountTime = RealTime + skill.cooldown; skill.CountBuffTime = RealTime + skill.Timer; skilltime.Add(skill); DispatcherSetup(); }
public SkillImage(double widthSize, double heightSize, SkillGenerics skill, bool OnBar) { this.OnBar = OnBar; image = new Image() { Width = widthSize, Height = heightSize }; Children.Add(image); if (OnBar) { CooldownImage = new Canvas() { Width = widthSize, Height = heightSize }; Children.Add(CooldownImage); } this.skill = skill; if (skill != null) { image.Source = new BitmapImage(new Uri("ms-appx://" + skill.pathImage)); } if (skill != null) { position = (uint)SkillManager.instance.SkillList.IndexOf(skill); } PointerEntered += InterfaceManager.instance.UpdateSkillWindowText; PointerExited += InterfaceManager.instance.CloseSkillWindowText; if (!OnBar) { PointerPressed += InterfaceManager.instance.SkillTreePointerEvent; } UpdateImage(); }
private void Timer(object sender, object e) { SkillGenerics[] removeSkills = new SkillGenerics[skilltime.Count]; int count = 0; foreach (SkillGenerics habilite in skilltime)//para verificar se as skills ja acabaram seus tempos de CD { if (habilite.CountTime <= RealTime) { habilite.CountTime = 0; habilite.Active = true; habilite.locked = true; removeSkills[count] = habilite; count++; //skilltime.Remove(habilite); } if (habilite.CountBuffTime <= RealTime) { habilite.CountBuffTime = 0; habilite.RevertSkill(myPlayer); } } foreach (SkillGenerics s in removeSkills) { skilltime.Remove(s); } RealTime++; }
public void ChangeSkill(SkillGenerics skill) { if (skill.tipo == SkillType.habilite) { foreach (SkillGenerics s in SkillBar) { if (s != null) { if (s.Equals(skill)) { return; } } } for (int i = 0; i < 3; i++) { if (SkillBar[i] == null) { SkillBar[i] = skill; break; } } } else if (skill.tipo == SkillType.ultimate) { SkillBar[3] = skill; //if (SkillBar[3] == null) //{ //} } }
private void Timer(object sender, object e) { int count = 0; SkillGenerics[] removeStatus = new SkillGenerics[status.Count]; foreach (SkillGenerics habilite in status)//para verificar se as skills ja acabaram seus tempos de CD { if (habilite.tipobuff != SkillTypeBuff.normal) { if (habilite.CountBuffTime <= RealTime) { habilite.CountBuffTime = 0; habilite.RevertSkill(this); removeStatus[count] = habilite; count++; } } } foreach (SkillGenerics s in removeStatus) { status.Remove(s); } if (status.Count == 0) { dispatcherTimer.Stop(); } RealTime++; }
public bool UpSkill(SkillGenerics skill) { int MinimiumLevel = 0; if (SkillPoints <= 0 || !TestLevelBlock(skill)) { return(false); } if (!skill.Unlocked) { if (UnlockSkill(skill)) { SkillPoints--; skill.Unlocked = true; for (int i = 0; i < 3; i++) { if (SkillBar[i] == null) { AddSkillToBar(skill, i); break; } } return(true); } else { return(false); } } else { if (skill.tipo == SkillType.ultimate) { MinimiumLevel = 10; } else if (skill.tipo == SkillType.passive) { MinimiumLevel = 15; } else if (skill.tipo == SkillType.habilite) { MinimiumLevel = 25; } if (skill.Lvl < MinimiumLevel) { skill.Lvl++; SkillPoints--; skill.Unlocked = true; return(true); } else { return(false); } } }
public SkillManager(Player myPlayer) { instance = this; SkillPoints = 0; this.myPlayer = myPlayer; SkillList = new List <SkillGenerics>(); SkillBar = new SkillGenerics[4]; //DispatcherSetup(); }
private bool TestLevelBlock(SkillGenerics skill) { if (myPlayer.level.actuallevel > skill.block) { return(true); } return(false); }
public bool UnlockSkill(SkillGenerics skillToUnlock) { if (myPlayer.level.actuallevel >= skillToUnlock.block) { skillToUnlock.Unlocked = true; SkillPoints--; return(true); } return(false); }
public void InsereStatus(SkillGenerics stats) { bool a = status.Count == 0; status.Add(stats); stats.CountTime = RealTime + stats.cooldown; stats.CountBuffTime = RealTime + stats.timer; if (a) { DispatcherSetup(); } }
public void Update() { if (Attacking) { Attack(null); CanAtk = false; } if (UsingSkill != null) { AttackSkill(UsingSkill); UsingSkill = null; } }
public void AttackSkill(SkillGenerics skill) { DynamicSolid Dsolid = (box as DynamicSolid); HitSolid hit = null; Solid tDynamic = null; if (HitPool.PoolSize > 0) { HitPool.GetFromPool(out hit); skill.UpdateThrow(hit, this); hit.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { if (skill.Active) { hit = skill.Throw(this); } InterfaceManager.instance.CanvasChunck01.Children.Add(hit); } if (hit == null) { return; } tDynamic = hit.Interaction(); if (!(tDynamic == null || tDynamic.MyEnt == null)) { if (skill.tipobuff == SkillTypeBuff.debuff) { tDynamic.MyEnt.InsereStatus(skill); } double dano = skill.UseSkill(this, tDynamic.MyEnt); tDynamic.MyEnt.BeHit(dano, this); } }
public void AddSkillToBar(SkillGenerics s, int index) { SkillBar[index] = s; }
public void Attack(SkillGenerics skill) { if (!CanAtk) { return; } DynamicSolid Dsolid = (box as DynamicSolid); HitSolid hit = null; DynamicSolid tDynamic = null; double hitboxSize = 50; double speeed = Ranged == true ? 4 : 0; if (HitPool.PoolSize > 0)//verificar a pool { HitPool.GetFromPool(out hit); hit.speed = speeed; hit.Yi = box.Yi; hit.Who = box as DynamicSolid; hit.Visibility = Windows.UI.Xaml.Visibility.Visible; if (Dsolid.lastHorizontalDirection == 1) { hit.Xi = box.Xf; } else if (Dsolid.lastHorizontalDirection == -1) { hit.Xi = box.Xi - hitboxSize; } hit.Start(null, null); //.alive = true; } else { if (Dsolid.lastHorizontalDirection == 1) { hit = new HitSolid(box.Xf + 10, box.Yi + 20, hitboxSize, box.Height / 2, box as DynamicSolid, speeed); hit.Start(null, null);//hit.alive = true; } else if (Dsolid.lastHorizontalDirection == -1) { hit = new HitSolid(box.Xi - hitboxSize - 10, box.Yi + 20, hitboxSize, box.Height / 2, box as DynamicSolid, speeed); hit.Start(null, null);//hit.alive = true; } InterfaceManager.instance.CanvasChunck01.Children.Add(hit); } if (hit == null) { return; } Solid s = hit.Interaction(); if (!(tDynamic == null || tDynamic.MyEnt == null)) { if (skill != null) { tDynamic.MyEnt.BeHit(skill.UseSkill(this, tDynamic.MyEnt), this); } else { tDynamic.MyEnt.BeHit(Hit(0), this); } //hit.speed = 0; } AtkT = 0; Attacking = false; }