Beispiel #1
0
	    private void Awake()
	    {
	        //Rigidbody = GetComponent<Rigidbody>();
	        _transform = GetComponent<Transform>();

			Weapons = new List<WeaponStruct> ();

			Weapons.Add (new WeaponStruct() {
				Name = "Fist",
				ScriptName = "Fist",
				Count = -1
			});

			Weapons.Add (new WeaponStruct() {
				Name = "Bazooka",
				ScriptName = "Bazooka",
				Count = 100
			});

            Weapons.Add(new WeaponStruct()
            {
                Name = "Rifle",
                ScriptName = "Rifle",
                Count = -1
            });

            Weapons.Add(new WeaponStruct()
            {
                Name = "Grenade",
                ScriptName = "Grenade",
                Count = -1
            });

            Weapons.Add(new WeaponStruct()
            {
                Name = "Dynamite",
                ScriptName = "Dynamite",
                Count = -1
            });

            Weapons.Add(new WeaponStruct()
            {
                Name = "Jetpack",
                ScriptName = "Jetpack",
                Count = -1
            });

			CurrentWeapon = (Weapon)gameObject.GetComponent("MostDanger.Fist");
	        CurrentWeapon.OnSelect();
	    }
Beispiel #2
0
	    private void OnInventorySelect (WeaponStruct weapon) 
		{
			if (CurrentWeapon)
			{
                CurrentWeapon.OnDeselect();
			}

			CurrentWeapon = (Weapon)gameObject.GetComponent("MostDanger." + weapon.ScriptName);
            CurrentWeapon.OnSelect();
		}