IEnumerator explode() { yield return(new WaitForSeconds(2)); Instantiate(explotion, transform.position, Quaternion.identity); float aux; aux = (transform.position.z + 5) % 20; if (aux > 15 || aux < 5) { Explotion temp = Instantiate(explotion, new Vector3(transform.position.x - GameplayController.chunkSize, transform.position.y, transform.position.z), Quaternion.identity).GetComponent <Explotion>(); temp.explotionsLeft = explotionRadio - 1; temp.sideToInsantiate = Explotion.Side.back; temp = Instantiate(explotion, new Vector3(transform.position.x + GameplayController.chunkSize, transform.position.y, transform.position.z), Quaternion.identity).GetComponent <Explotion>(); temp.explotionsLeft = explotionRadio - 1; temp.sideToInsantiate = Explotion.Side.forward; } aux = (transform.position.x + 5) % 20; if (aux > 15 || aux < 5) { Explotion temp = Instantiate(explotion, new Vector3(transform.position.x, transform.position.y, transform.position.z - GameplayController.chunkSize), Quaternion.identity).GetComponent <Explotion>(); temp.explotionsLeft = explotionRadio - 1; temp.sideToInsantiate = Explotion.Side.left; temp = Instantiate(explotion, new Vector3(transform.position.x, transform.position.y, transform.position.z + GameplayController.chunkSize), Quaternion.identity).GetComponent <Explotion>(); temp.explotionsLeft = explotionRadio - 1; temp.sideToInsantiate = Explotion.Side.right; } Destroy(gameObject); }
public override void Update(Microsoft.Xna.Framework.GameTime gameTime) { for (int i = 0; i < moves.Count; i++) { MoveModel move = moves[i]; if (move.Stats.Type != MoveType.Range && (move.attackTimeLeft <= 0 || move.Ended)) { EndMove(move); RemoveMove(move); } } DebugWrite(playerIndex + "LOL", moves.Count); for (int i = 0; i < explotions.Count; i++) { Explotion explotion = explotions[i]; explotion.TimeLeft -= gameTime.ElapsedGameTime.Milliseconds; if (explotion.TimeLeft <= 0) { explotion.Img.BoundBox.Dispose(); explotions.Remove(explotion); i--; } else { explotion.Img.BoundBox.Dispose(); explotion.Img.CurrentPos -= explotion.Size * explotion.TimeLeft / explotion.Duration / 2; explotion.Img.SetBoundBox(World, (int)MathHelper.Max((float)(explotion.TimeLeft / explotion.Duration * explotion.Size.X), 1), (int)MathHelper.Max((float)(explotion.TimeLeft / explotion.Duration * explotion.Size.Y), 1), Vector2.Zero, Category.Cat31, Category.Cat11, true); explotion.Img.BoundBox.IgnoreGravity = true; explotion.Img.BoundBox.IsStatic = true; explotion.Img.BoundBox.UserData = explotion; explotion.Img.BoundBox.OnCollision += ExplodeHit; } } }
public void IsExplotion(string _incidentName) { if (_incidentName == "Explotion") { Explotion?.Invoke(); } }
private void Explode(Explotion explotion, Vector2 pos) { explotion.PlayerIndex = playerIndex; explotion.Img = Img.AddPosition(pos); explotion.Img.SetBoundBox(World, 10, 10, Vector2.Zero, Category.Cat20, FarseerPhysics.Dynamics.Category.Cat11); //explotion.Img.CurrentFrame = -1; explotion.Img.BoundBox.IgnoreGravity = true; explotion.Img.BoundBox.IsStatic = true; explotion.Img.BoundBox.UserData = explotion; explotion.Img.BoundBox.OnCollision += ExplodeHit; explotions.Add(explotion); }
void OnAbduction(Character character) { print("ABDUCTION" + character); id++; if (id > 5) { id = 0; } Explotion newExplotion = Instantiate(explotion); newExplotion.transform.position = character.transform.position; newExplotion.Init(id); }
private bool ExplodeHit(Fixture explotionFixture, Fixture characterFixture, Contact list) { CharacterController character = (CharacterController)characterFixture.Body.UserData; character.model.damagePoints += 5; Explotion explotion = (Explotion)explotionFixture.Body.UserData; Vector2 pos = explotion.Img.CurrentPos + explotion.Img.Origin; Vector2 velocityPlus = character.view.Position - pos; velocityPlus.Normalize(); velocityPlus *= new Vector2(5, 5); character.view.Velocity += velocityPlus; character.HitByExplotion(explotion.PlayerIndex, pos); return(false); }
IEnumerator SpawnNextExplotion() { yield return(null); yield return(null); if (explotionsLeft > 0) { switch (sideToInsantiate) { case Side.left: Explotion temp = Instantiate(explotion, new Vector3(transform.position.x, transform.position.y, transform.position.z - GameplayController.chunkSize), Quaternion.identity).GetComponent <Explotion>(); temp.explotionsLeft = explotionsLeft - 1; temp.sideToInsantiate = sideToInsantiate; break; case Side.right: Explotion temp1 = Instantiate(explotion, new Vector3(transform.position.x, transform.position.y, transform.position.z + GameplayController.chunkSize), Quaternion.identity).GetComponent <Explotion>(); temp1.explotionsLeft = explotionsLeft - 1; temp1.sideToInsantiate = sideToInsantiate; break; case Side.forward: Explotion temp2 = Instantiate(explotion, new Vector3(transform.position.x + GameplayController.chunkSize, transform.position.y, transform.position.z), Quaternion.identity).GetComponent <Explotion>(); temp2.explotionsLeft = explotionsLeft - 1; temp2.sideToInsantiate = sideToInsantiate; break; case Side.back: Explotion temp3 = Instantiate(explotion, new Vector3(transform.position.x - GameplayController.chunkSize, transform.position.y, transform.position.z), Quaternion.identity).GetComponent <Explotion>(); temp3.explotionsLeft = explotionsLeft - 1; temp3.sideToInsantiate = sideToInsantiate; break; } } }
void OnAddExplotion(Vector3 pos) { Explotion new_explotion = Instantiate(explotion); new_explotion.Init(pos); }
// Creates an explotion of the Prefab Explotion at the molecule's position public void Explode() { explotion = Instantiate(explotion, transform.position, Quaternion.identity); }