public void changeWeapon(int change) { weaponSelected += change; if (change != 0) { playSound(modeChange); } if ((int)weaponSelected > 2) { weaponSelected = (Weapon_Type)0; } else if ((int)weaponSelected < 0) { weaponSelected = (Weapon_Type)2; } switch (weaponSelected) { case Weapon_Type.SWORD: changeToSword(); break; case Weapon_Type.BLUNT: changeToBlunt(); break; case Weapon_Type.DISCUS: changeToDiscus(); break; } glowLight.color = material.color; }
private void buttonProcessFile_Click(object sender, EventArgs e) { try { //define variables StreamReader reader; StreamWriter writer; string Weapon_Name; string Weapon_Type; int Weapon_Damage; double Weapon_Speed; double Weapon_DPS; int line; //define dialog filter openFileDialog1.Filter = "Text files (*.txt)|*.txt"; //open file selection dialog if (openFileDialog1.ShowDialog() == DialogResult.OK) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { try { //line count for error line = 0; //open file reader = File.OpenText(openFileDialog1.FileName); writer = File.CreateText(saveFileDialog1.FileName); writer.WriteLine("Weapon Name".PadRight(25) + "Weapon Type".PadRight(15) + "Damage".PadRight(15) + "Attack Speed".PadRight(15) + "DPS".PadRight(8)); //run through all lines while (!reader.EndOfStream) { //read next line Weapon_Name = reader.ReadLine(); Weapon_Type = reader.ReadLine(); Weapon_Damage = int.Parse(reader.ReadLine()); Weapon_Speed = double.Parse(reader.ReadLine()); Weapon_DPS = CalculateDPS(Weapon_Damage, Weapon_Speed); line++; writer.WriteLine(Weapon_Name.PadRight(25) + Weapon_Type.PadRight(15) + Weapon_Damage.ToString().PadRight(15) + Weapon_Speed.ToString().PadRight(15) + Weapon_DPS.ToString().PadRight(10)); } writer.WriteLine("weapon count: " + line); reader.Close(); writer.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Reload(Weapon_Type weapon_type) { player = game.player; if (Keyboard.GetState().IsKeyDown(Keys.R)) { player.Bullet_Number = Create_Clip(weapon_type); } }
private void changeToDiscus() { material.color = starModeBloom; weaponSelected = Weapon_Type.DISCUS; attackRange = discusRadius; //update animation }
private void changeToBlunt() { material.color = moonModeBloom; weaponSelected = Weapon_Type.BLUNT; attackRange = bluntRange; //update animation }
private void changeToSword() { material.color = sunModeBloom; weaponSelected = Weapon_Type.SWORD; attackRange = swordRange; //update animation }
//CONSTRUCTORS public Player(Game1 game,int pv_max, int pv, Weapon_Type weapon) { this.game = game; this.pv_max = pv_max; this.pv = pv; this.weapon = weapon; _screenwidth = game.screenwidth; _screenheight = game.screenheight; }
public void SendGameMessage <T>(Message_Type type, Weapon_Type weapon) { switch (type) { case Message_Type.EnemyGetHit: if (_enemy) { _enemy.SendMessage("GetHit", weapon); } break; } }
public void takeDamage(Weapon_Type weapon, int damage) { currentHP -= damage * weaknesses[(int)weapon]; //Check for death if (currentHP <= 0) { Die(); return; } //Manage health bar if (healthBar == null && healthBarPos != null) { healthBar = Instantiate(healthBarPrefab); healthBar.transform.position = transform.position + healthBarPos; healthBar.GetComponentInChildren <HealthBar>().SetHealth(currentHP / maximumHP); } else if (healthBar != null) { healthBar.GetComponentInChildren <HealthBar>().SetHealth(currentHP / maximumHP); } switch (weapon) { case Weapon_Type.SWORD: DOTween.Kill(transform); Vector3 targetPos = transform.position + (target.position - transform.position).normalized * (damage / -10f); transform.DOMove(targetPos, 2f); break; case Weapon_Type.BLUNT: DOTween.Kill(transform); Vector3 targetPos2 = transform.position + (target.position - transform.position).normalized * (damage / -5f); transform.DOMove(targetPos2, 2f); break; default: break; } }
public int Create_Clip(Weapon_Type weapon_type) { int count = 0; if (weapon_type == Weapon_Type.Gun) { return count = 10; } if (weapon_type == Weapon_Type.Bazooka) { return count = 1; } if (weapon_type == Weapon_Type.Rifle) { return count = 20; } if (weapon_type == Weapon_Type.Sniper) { return count = 5; } else return 0; }
public override string ToString() { return(Weapon_ID.ToString().PadRight(5) + Weapon_Type.PadRight(10) + Weapon_Damage.ToString().PadRight(5) + Weapon_Cost.ToString("C")); }
public SoundEffect SoundOf(Weapon_Type weapon) { switch (weapon) { case Weapon_Type.Sniper: return game.seffect_gun; case Weapon_Type.Rifle: return game.seffect_gun; case Weapon_Type.Gun: return game.seffect_gun; case Weapon_Type.Bazooka: return game.seffect_gun; default: return game.seffect_gun; } }
//Constructor public void Weapon(Weapon_Type weapon, Bullet_Type bullet) { this.weapon_type = weapon; this.bullet = bullet; }
/// <summary> /// 文字列をenumに変換 /// </summary> /// <param name="s">文字列</param> void SetEnum(string s) { _weapontype = (Weapon_Type)Enum.Parse(typeof(Weapon_Type), s); }