public WeaponInfo(XElement weapon)
        {
            name = (String)weapon.Attribute("name");
            damage = (uint)weapon.Attribute("damage");
            ROT = (float)weapon.Attribute("rot");
            magSize = (uint)weapon.Attribute("magsize");
            imprecision = (float)(Math.PI / (float)weapon.Attribute("imprecision"));
            reloadTime = (float)weapon.Attribute("reloadtime");

            //			Console.WriteLine("name is "+name);
            //			Console.WriteLine("damage is "+damage);
            //			Console.WriteLine("rot is "+ROT);
            //			Console.WriteLine("magsize is "+magSize);
            //			Console.WriteLine("imprecision is "+imprecision);
            //
            //			Console.WriteLine("type in XML is "+weapon.Attribute("type"));

            type = (WeaponInfo.Type)Enum.Parse(typeof(WeaponInfo.Type), (String)weapon.Attribute("type"));

            //			Console.WriteLine("type in enum became: "+type);
        }
Exemple #2
0
 public void SetWeapon(WeaponInfo weaponInfo)
 {
     currentWeaponInfo     = weaponInfo;
     weaponType            = weaponInfo?.type ?? WeaponInfo.Type.None;
     spriteRenderer.sprite = weaponInfo?.sprite;
 }