protected override void Deteccion(DeteccionInformacion info) { if (!activo) { return; } Entidad entidad = info.GetEntidadDetectada(); Colision colision = info.GetColisionDetectada(); JugadorBasico personaje = (JugadorBasico)entidad; if (personaje == null) { return; } switch (tipoitem) { case ItemTipo.PUNTAJE: ControlGameplayBasico.GetInstancia().ModPuntaje((int)valor); break; case ItemTipo.ENERGIA: personaje.ModEnergia(valor); break; case ItemTipo.VIDA: personaje.ModVida(valor); break; case ItemTipo.ATAQUE: personaje.ModAtaque(valor); break; case ItemTipo.REDUCCIONDAÑO: personaje.ModReduccionDaño(valor); break; } Muerte(); }
public Bullet(Vector2 position, Vector2 angle) { Position = position; Position.Y += 16; if (angle != Vector2.Zero) { angle.Normalize(); } // float angles = (float)Cordionats.AngleMouse((int)position.X, (int)position.Y); _dirX = angle.X; _dirY = angle.Y; Velocity.X += 32 * _dirX; Velocity.Y = Velocity.Y + 32 * _dirY; Velocity = Colision.TileCollision(this, position, Velocity, BulletSizeX, BulletSizeY, true); Position += Velocity; _time = 0; Velocity = Vector2.Zero; Velocity.Y = _dirY * 1; Velocity.X = _dirX * 1; TypeBullet = 1; SoundPulse(); }
public static string[] SplitedString; // The Splited String public static void ReadAsync(string Command) { SplitedString = Command.Split(' '); // The Splited String // Format the current Taiyou Line for (int i = 0; i < SplitedString.Length; i++) { // FORMATATION SplitedString[i] = SplitedString[i].Replace("%N", Environment.NewLine); // New Line for (int i2 = 0; i2 < GlobalVars_String_Names.Count; i2++) { SplitedString[i] = SplitedString[i].Replace("$STRING_" + GlobalVars_String_Names[i2] + "$", GlobalVars_String_Content[i2].Replace(" ", "")); } for (int i2 = 0; i2 < GlobalVars_Bool_Names.Count; i2++) { SplitedString[i] = SplitedString[i].Replace("$BOOL_" + GlobalVars_Bool_Names[i2] + "$", Convert.ToString(GlobalVars_Bool_Content[i2])); } for (int i2 = 0; i2 < GlobalVars_Int_Names.Count; i2++) { SplitedString[i] = SplitedString[i].Replace("$INT_" + GlobalVars_Int_Names[i2] + "$", Convert.ToString(GlobalVars_Int_Content[i2])); } for (int i2 = 0; i2 < GlobalVars_Float_Names.Count; i2++) { SplitedString[i] = SplitedString[i].Replace("$FLOAT_" + GlobalVars_Float_Names[i2] + "$", Convert.ToString(GlobalVars_Float_Content[i2])); } if (SplitedString[i].Contains("%RANDOM%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 Random RND = new Random(); SplitedString[i] = SplitedString[i].Replace("%RANDOM%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(RND.Next(Convert.ToInt32(Arg1), Convert.ToInt32(Arg2)))); } if (SplitedString[i].Contains("%ADD%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 int MathResult = Convert.ToInt32(Arg1) + Convert.ToInt32(Arg2); SplitedString[i] = SplitedString[i].Replace("%ADD%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%DECREASE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 int MathResult = Convert.ToInt32(Arg1) - Convert.ToInt32(Arg2); SplitedString[i] = SplitedString[i].Replace("%DECREASE%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%MULTIPLY%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // MultiplyTimes int MathResult = Convert.ToInt32(Arg1) * Convert.ToInt32(Arg2); SplitedString[i] = SplitedString[i].Replace("%MULTIPLY%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%DIVIDE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 int MathResult = Convert.ToInt32(Arg1) / Convert.ToInt32(Arg2); SplitedString[i] = SplitedString[i].Replace("%DIVIDE%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%DIFERENCE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 int MathResult = Math.Abs(Convert.ToInt32(Arg1) - Convert.ToInt32(Arg2)); SplitedString[i] = SplitedString[i].Replace("%DIFERENCE%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%PERCENTAGE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Number 1 string Arg2 = SubSplitedString[3]; // Number 2 int MathResult = (int)Math.Round((double)(100 * Convert.ToInt32(Arg1)) / Convert.ToInt32(Arg2)); SplitedString[i] = SplitedString[i].Replace("%PERCENTAGE%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(MathResult)); } if (SplitedString[i].Contains("%LOCATION_OF%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // Render Type string Arg2 = SubSplitedString[3]; // Render Name string Arg3 = SubSplitedString[4]; // Value Type Rectangle RectObject = GlobalVars_Rectangle_Content[RenderQuee.Main.RenderCommand_RectangleVar.IndexOf(Arg2)]; int RenderNameIndex = -1; if (Arg1 == "SPRITE") { RenderNameIndex = RenderQuee.Main.RenderCommand_Name.IndexOf(Arg2); } ; if (Arg1 == "TEXT") { RenderNameIndex = RenderQuee.Main.TextRenderCommand_Name.IndexOf(Arg2); } ; int ValToReturn = 0; if (Arg3 == "X" && Arg1 == "SPRITE") { ValToReturn = RectObject.X; } ; if (Arg3 == "X" && Arg1 == "TEXT") { ValToReturn = RenderQuee.Main.TextRenderCommand_X[RenderNameIndex]; } if (Arg3 == "Y" && Arg1 == "SPRITE") { ValToReturn = RectObject.Y; } ; if (Arg3 == "Y" && Arg1 == "TEXT") { ValToReturn = RenderQuee.Main.TextRenderCommand_Y[RenderNameIndex]; } ; if (Arg3 == "W" && Arg1 == "SPRITE") { ValToReturn = RectObject.Width; } ; if (Arg3 == "H" && Arg1 == "SPRITE") { ValToReturn = RectObject.Height; } ; SplitedString[i] = SplitedString[i].Replace("%LOCATION_OF%" + Arg1 + "%" + Arg2 + "%" + Arg3 + "%", Convert.ToString(ValToReturn)); } if (SplitedString[i].Contains("%COLOR_VALUE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string Arg1 = SubSplitedString[2]; // ColorVarName string Arg2 = SubSplitedString[3]; // CodeName int ColorVarIndex = GlobalVars_Color_Names.IndexOf(Arg1); string ValToReturn = "0"; if (ColorVarIndex == -1) { throw new Exception("Color Variable [" + Arg1 + "] does not exist."); } if (Arg2.Equals("R")) { ValToReturn = Convert.ToString(GlobalVars_Color_Content[ColorVarIndex].R); } ; if (Arg2.Equals("G")) { ValToReturn = Convert.ToString(GlobalVars_Color_Content[ColorVarIndex].G); } ; if (Arg2.Equals("B")) { ValToReturn = Convert.ToString(GlobalVars_Color_Content[ColorVarIndex].B); } ; if (Arg2.Equals("A")) { ValToReturn = Convert.ToString(GlobalVars_Color_Content[ColorVarIndex].A); } ; if (Arg2.Equals("ALL")) { ValToReturn = GlobalVars_Color_Content[ColorVarIndex].R + "," + GlobalVars_Color_Content[ColorVarIndex].G + "," + GlobalVars_Color_Content[ColorVarIndex].B + "," + GlobalVars_Color_Content[ColorVarIndex].A; } ; SplitedString[i] = SplitedString[i].Replace("%COLOR_VALUE%" + Arg1 + "%" + Arg2 + "%", Convert.ToString(ValToReturn)); } if (SplitedString[i].Contains("%LIST_VALUE%")) { string[] SubSplitedString = SplitedString[i].Split('%'); string ValToReturn = "null_or_incorrect"; string Arg1 = SubSplitedString[2]; // ListType string Arg2 = SubSplitedString[3]; // ListName string Arg3 = SubSplitedString[4]; // Index if (Arg1.Equals("STRING")) { int ListNameIndex = GlobalVars_StringList_Names.IndexOf(Arg2); int Index = Convert.ToInt32(Arg3); ValToReturn = GlobalVars_StringList_Content[ListNameIndex][Index]; } if (Arg1.Equals("INT")) { int ListNameIndex = GlobalVars_IntList_Names.IndexOf(Arg2); int Index = Convert.ToInt32(Arg3); ValToReturn = Convert.ToString(GlobalVars_IntList_Content[ListNameIndex][Index]); } if (Arg1.Equals("COLOR")) { int ListNameIndex = GlobalVars_ColorList_Names.IndexOf(Arg2); int Index = Convert.ToInt32(Arg3); Color ColorGetted = GlobalVars_ColorList_Content[ListNameIndex][Index]; string ColorCodeToReturn = ColorGetted.R + "," + ColorGetted.G + "," + ColorGetted.B + "," + ColorGetted.A; ValToReturn = ColorCodeToReturn; } if (Arg1.Equals("FLOAT")) { int ListNameIndex = GlobalVars_FloatList_Names.IndexOf(Arg2); int Index = Convert.ToInt32(Arg3); ValToReturn = Convert.ToString(GlobalVars_FloatList_Content[ListNameIndex][Index]); } if (Arg1.Equals("RECTANGLE")) { int ListNameIndex = GlobalVars_RectangleList_Names.IndexOf(Arg2); int Index = Convert.ToInt32(Arg3); Rectangle RectGetted = GlobalVars_RectangleList_Content[ListNameIndex][Index]; string RectangleCode = RectGetted.X + "," + RectGetted.Y + "," + RectGetted.Width + "," + RectGetted.Height; ValToReturn = Convert.ToString(RectangleCode); } SplitedString[i] = SplitedString[i].Replace("%LIST_VALUE%" + Arg1 + "%" + Arg2 + "%" + Arg3 + "%", Convert.ToString(ValToReturn)); } } // Begin Command Interpretation if (SplitedString[0].Equals("0x0")) { Clear.Initialize(); } if (SplitedString[0].Equals("0x1")) { Call.Initialize(SplitedString[1]); } if (SplitedString[0].Equals("0x2")) { Write.Initialize(SplitedString[1]); } if (SplitedString[0].Equals("0x3")) { WriteLine.Initialize(SplitedString[1]); } if (SplitedString[0].Equals("0x4")) { WriteFile.Initialize(SplitedString[1], SplitedString[2]); } if (SplitedString[0].Equals("0x5")) { TaiyouIF.Initialize(SplitedString); } if (SplitedString[0].Equals("0x6")) { Abort.Initialize(); } if (SplitedString[0].Equals("0x7")) { Declare.Initialize(SplitedString); } if (SplitedString[0].Equals("0x8")) { WriteVar.Initialize(SplitedString); } if (SplitedString[0].Equals("0x9")) { MathOP.Intialize(SplitedString); } if (SplitedString[0].Equals("1x0")) { Goto.Initialize(SplitedString); } if (SplitedString[0].Equals("1x1")) { FileExists.Initialize(SplitedString); } if (SplitedString[0].Equals("1x2")) { ReadFile.Intialize(SplitedString); } if (SplitedString[0].Equals("1x3")) { DirectoryExists.Initialize(SplitedString); } if (SplitedString[0].Equals("1x4")) { DownloadServerString.Initialize(SplitedString); } if (SplitedString[0].Equals("1x5")) { CopyFile.Initialize(SplitedString); } if (SplitedString[0].Equals("1x6")) { MoveFile.Initialize(SplitedString); } if (SplitedString[0].Equals("1x7")) { DeleteFile.Initialize(SplitedString); } if (SplitedString[0].Equals("1x8")) { AddRenderQuee.Initialize(SplitedString); } if (SplitedString[0].Equals("1x9")) { AddEvent.Initialize(SplitedString); } if (SplitedString[0].Equals("2x0")) { CheckEvent.Initialize(SplitedString); } if (SplitedString[0].Equals("2x1")) { ChangeWindowPropertie.Initialize(SplitedString); } if (SplitedString[0].Equals("2x2")) { Colision.Initialize(SplitedString); } if (SplitedString[0].Equals("2x3")) { Reload.Initialize(SplitedString); } if (SplitedString[0].Equals("2x4")) { GetKeyPressed.Initialize(SplitedString); } if (SplitedString[0].Equals("2x5")) { AddRenderTextQuee.Initialize(SplitedString); } if (SplitedString[0].Equals("2x6")) { ChangeRenderProp.Initialize(SplitedString); } if (SplitedString[0].Equals("2x7")) { ChangeBackgroundColor.Initialize(SplitedString); } if (SplitedString[0].Equals("2x8")) { Undeclare.Initialize(SplitedString); } if (SplitedString[0].Equals("2x9")) { SendBGMCommand.Initialize(SplitedString); } if (SplitedString[0].Equals("3x0")) { MasterVolume.Initialize(SplitedString); } if (SplitedString[0].Equals("3x1")) { LanguageSystemManager.Initialize(SplitedString); } if (SplitedString[0].Equals("3x2")) { // FIXME Not Working //VarMath.Initialize(SplitedString); } if (Global.IsLowLevelDebugEnabled) { for (int i = 0; i < SplitedString.Length; i++) { Console.Write(SplitedString[i] + " "); } Console.Write("\n"); } }
public bool Move() { OldPosition = Position; _time += Program.Game.Seconds; // float velrev = (mass * 9.8f) - (ase); if (Velocity.X <= 10 && Velocity.X >= -10) { Velocity.X += ASE * Program.Game.Seconds * _dirX; //this.velocity.X += ((velrev * Program.game.seconds) * (float)dirx ); } // _dirY -= (float)((9.8f*mass) * Program.game.seconds); Velocity.Y += 0.2f; Velocity = Colision.TileCollision(this, Position, Velocity, BulletSizeX, BulletSizeY, true); Position += Velocity; if (Math.Abs(Velocity.X) < float.Epsilon)//Y равен { _countRotate++; _dirX *= -1; } if (Math.Abs(Velocity.Y) < float.Epsilon && Math.Abs(_dirY) > float.Epsilon) { _countRotate++; _dirY *= -1; } if (Program.Game.Dimension[Program.Game.CurrentDimension].Zombies.Any(TryDmg)) { return(false); } if (Tools.InCube(new Rectangle((int)Position.X, (int)Position.Y, BulletSizeX, BulletSizeY), new Rectangle((int)Program.Game.Player.Position.X, (int)Program.Game.Player.Position.Y , Program.Game.Player.Width, 18))) //head { Program.Game.Player.DamageHead(); return(false); } if (Tools.InCube(new Rectangle((int)Position.X, (int)Position.Y, BulletSizeX, BulletSizeY), new Rectangle((int)Program.Game.Player.Position.X, (int)Program.Game.Player.Position.Y + 18 , Program.Game.Player.Width, 20)))//body { if (!Program.Game.Player.Slot[Player.SLOTMAX + 1].IsEmpty) { Program.Game.Player.DamageArmor(1); Program.Game.Player.AddForce(Velocity, MASS); } else { if (Velocity.X <= 0) { Program.Game.Player.Bloods[3] = true; } else { Program.Game.Player.Bloods[2] = true; } } return(false); } if (Tools.InCube(new Rectangle((int)Position.X, (int)Position.Y, BulletSizeX, BulletSizeY), new Rectangle((int)Program.Game.Player.Position.X, (int)Program.Game.Player.Position.Y + 18 + 20 , Program.Game.Player.Width, 24)))//legs { if (!Program.Game.Player.Slot[Player.SLOTMAX + 2].IsEmpty) { Program.Game.Player.DamageArmor(2); } else { if (Velocity.X <= 0) { Program.Game.Player.Bloods[0] = true; } else { Program.Game.Player.Bloods[1] = true; } } return(false); } if (TypeBullet == 0) { return(_time < MaxTime); } return(_countRotate < 1); }