Esempio n. 1
0
    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;
    }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
 public void Reload(Weapon_Type weapon_type)
 {
     player = game.player;
     if (Keyboard.GetState().IsKeyDown(Keys.R))
     {
         player.Bullet_Number = Create_Clip(weapon_type);
     }
 }
Esempio n. 4
0
    private void changeToDiscus()
    {
        material.color = starModeBloom;
        weaponSelected = Weapon_Type.DISCUS;
        attackRange    = discusRadius;

        //update animation
    }
Esempio n. 5
0
    private void changeToBlunt()
    {
        material.color = moonModeBloom;
        weaponSelected = Weapon_Type.BLUNT;
        attackRange    = bluntRange;

        //update animation
    }
Esempio n. 6
0
    private void changeToSword()
    {
        material.color = sunModeBloom;
        weaponSelected = Weapon_Type.SWORD;
        attackRange    = swordRange;

        //update animation
    }
Esempio n. 7
0
 //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;
 }
Esempio n. 8
0
 public void SendGameMessage <T>(Message_Type type, Weapon_Type weapon)
 {
     switch (type)
     {
     case Message_Type.EnemyGetHit:
         if (_enemy)
         {
             _enemy.SendMessage("GetHit", weapon);
         }
         break;
     }
 }
Esempio n. 9
0
    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;
        }
    }
Esempio n. 10
0
 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;
 }
Esempio n. 11
0
 public override string ToString()
 {
     return(Weapon_ID.ToString().PadRight(5) + Weapon_Type.PadRight(10) + Weapon_Damage.ToString().PadRight(5) + Weapon_Cost.ToString("C"));
 }
Esempio n. 12
0
        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;
            }
        }
Esempio n. 13
0
 //Constructor
 public void Weapon(Weapon_Type weapon, Bullet_Type bullet)
 {
     this.weapon_type = weapon;
     this.bullet = bullet;
 }
Esempio n. 14
0
 /// <summary>
 /// 文字列をenumに変換
 /// </summary>
 /// <param name="s">文字列</param>
 void SetEnum(string s)
 {
     _weapontype = (Weapon_Type)Enum.Parse(typeof(Weapon_Type), s);
 }