public static void NPC_6_OnAction(Geral x) { if (Interacoes.Falar(x, "Use este item para ganhar a batalha")) { Interacoes.DarItem(x, 3); } }
public override void Interagir(Geral p) { Geral p1 = PlayState.player1, p2 = PlayState.player2; if (this.tipo == 0 && p.vidas < 6) { p.vidas++; } else if (this.tipo == 1 && p.speed < 4) { p.speed++; } if (V.multiplayer) { if (this.tipo == 2 && p == p1 && p2.vidas <= 0) { p2.vidas = 1; } else if (this.tipo == 2 && p == p2 && p1.vidas <= 0) { p1.vidas = 1; } } V.bonus.RemoveAt(V.bonus.IndexOf(this)); }
public override void OnDie() { Geral p1 = PlayState.player1, p2 = PlayState.player2; if ((V.multiplayer && p1.vidas <= 0 && p2.vidas <= 0) || (!V.multiplayer && p1.vidas <= 0)) { PlayState.state = 3; } }
public override void OnStart() { SetEverything(); Geral x = Configuracoes.camera; V.view.Center = new Vector2f(x.x + (x.imgWidth / 2), x.y); V.cameraX = V.view.Center.X - ((Screen.width / V.Delta) / 2); V.cameraY = V.view.Center.Y - ((Screen.height / V.Delta) / 2); }
public static void BloquearMov(Geral x, bool y) { x.pausado = y; if (x is Playable) { Playable p = (Playable)x; p.andando = false; } }
public static void EditarMateria(Geral x) { editarMateria1 = true; editarMateria2 = x; colisaoX = editarMateria2.x; colisaoY = editarMateria2.y; colisaoW = editarMateria2.imgWidth; colisaoH = editarMateria2.imgHeight; }
public static void AddItem(Geral p, Item i) { if (p.itens.Contains(i)) { p.itens[p.itens.IndexOf(i)].quantidade++; } else { p.itens.Add(i); } }
public static void AtualizarZindex(Geral x1, Geral x2) { catX = ((x1.x + x1.adcX) + (x1.imgWidth / 2)) - ((x2.x + x2.adcX - 140) + ((280 + x2.imgWidth) / 2)); catY = ((x1.y + x1.height - x1.imgHeight) + (x1.imgHeight / 2)) - ((x2.y + x2.height) + 70); sumHalfWidth = (x1.imgWidth / 2) + ((280 + x2.imgWidth) / 2); sumHalfHeight = (x1.imgHeight / 2) + 70; if (Math.Abs(catX) < sumHalfWidth && Math.Abs(catY) < sumHalfHeight) { x1.zindex = x2.zindex + 2; } }
public static void AddRecurso(Geral x, int id, int qtd) { Recurso it = x.recursos.Find(item => item.id == id); if (it != null) { it.quantidade += qtd; } else { Recurso r = (Recurso)V.recursos[id - 1].Clone(); x.recursos.Add(r); x.recursos[x.recursos.IndexOf(r)].Add(qtd); } }
public static void ColideBloco(Geral x1, Geral x2, bool ajustarZindex) { catX = (x1.x + (x1.width / 2)) - (x2.x + (x2.width / 2)); catY = (x1.y + (x1.height / 2)) - (x2.y + (x2.height / 2)); sumHalfWidth = (x1.width / 2) + (x2.width / 2); sumHalfHeight = (x1.height / 2) + (x2.height / 2); if (Math.Abs(catX) <= sumHalfWidth && Math.Abs(catY) <= sumHalfHeight) { overlapX = sumHalfWidth - Math.Abs(catX); overlapY = sumHalfHeight - Math.Abs(catY); if (x2.GetType().Name == "Bullet" && V.bullets.IndexOf((Bullet)x2) != -1 && x2 != null) { x1.Interagir(x2); } else if (x2.GetType().Name == "Enemy" && x1.GetType().Name == "Player") { x1.vidas = x2.vidas = 0; } else if (x2.GetType().Name == "Bonus") { x2.Interagir(x1); } if (overlapX >= overlapY) { x1.y = (catY > 0) ? x2.y + x2.height : x1.y = x2.y - x1.height; } else { x1.x = (catX > 0 && x1.x + (x1.width / 2) >= x2.x) ? x2.x + x2.width : x2.x - x1.width; } } }
public static void ColideBloco(Geral x1, Geral x2, bool ajustarZindex) { catX = (x1.x + (x1.width / 2)) - (x2.x + (x2.width / 2)); catY = (x1.y + (x1.height / 2)) - (x2.y + (x2.height / 2)); sumHalfWidth = (x1.width / 2) + (x2.width / 2); sumHalfHeight = (x1.height / 2) + (x2.height / 2); if (Math.Abs(catX) <= sumHalfWidth && Math.Abs(catY) <= sumHalfHeight && !x1.pausado) { overlapX = sumHalfWidth - Math.Abs(catX); overlapY = sumHalfHeight - Math.Abs(catY); x2.Interagir(0); if (overlapX >= overlapY) { if (catY > 0) { x1.y = x2.y + x2.height; if (x == Configuracoes.controle && x1.direcao == 1 && F.Key("x") && !F.TeclaDesativada("x")) { x2.Interagir(1); F.DesativarTecla("x", 500); } } else { x1.y = x2.y - x1.height; if (x == Configuracoes.controle && x1.direcao == 0 && F.Key("x") && !F.TeclaDesativada("x")) { x2.Interagir(1); F.DesativarTecla("x", 500); } } } else { if (catX > 0 && x1.x + (x1.width / 2) >= x2.x) { x1.x = x2.x + x2.width; if (x == Configuracoes.controle && x1.direcao == 3 && F.Key("x") && !F.TeclaDesativada("x")) { x2.Interagir(1); F.DesativarTecla("x", 500); } } else { x1.x = x2.x - x1.width; if (x == Configuracoes.controle && x1.direcao == 2 && F.Key("x") && !F.TeclaDesativada("x")) { x2.Interagir(1); F.DesativarTecla("x", 500); } } } } if (ajustarZindex) { catX = ((x1.x + x1.adcX) + (x1.imgWidth / 2)) - ((x2.x + x2.adcX - 140) + ((280 + x2.imgWidth) / 2)); catY = ((x1.y + x1.height - x1.imgHeight) + (x1.imgHeight / 2)) - ((x2.y + x2.height) + 70); sumHalfWidth = (x1.imgWidth / 2) + ((280 + x2.imgWidth) / 2); sumHalfHeight = (x1.imgHeight / 2) + 70; if (Math.Abs(catX) < sumHalfWidth && Math.Abs(catY) < sumHalfHeight) { x1.zindex = x2.zindex + 1; x1.qtdObj++; } } }
public static void TremerTela(Geral x) { V.view.Move(new Vector2f(-10, 0)); }
public static void NPC_5_OnAction(Geral x) { Interacoes.Falar(x, "Boa sorte em sua jornada!"); }
public override void Interagir(Geral p) { V.bullets.RemoveAt(V.bullets.IndexOf((Bullet)p)); V.bullets.RemoveAt(V.bullets.IndexOf(this)); }
public override void Interagir(Geral p) { this.vidas -= p.forca; V.bullets.RemoveAt(V.bullets.IndexOf((Bullet)p)); }
public abstract void Interagir(Geral p);
public static void NPC_7_OnAction(Geral x) { Interacoes.Falar(x, "Eu sou max, é um prazer te conhecer :D"); }
public override void Interagir(Geral p) { }
public static void Set(Geral _npc, int _video) { npc = _npc; npc_ = _npc; video = _video; }