Weapon Manager Progress

Added code for Weapon Manager, so later on we can add multiple weapons.

We are focused on adding.

  1. Rope
  2. Shotgun
  3. Rifle

Here is a code of our weapon manager class

public class WeaponManager : MonoBehaviour 


    // list of all weapons prefabs references

    public GameObject WeaponRopePrefabRef;

    public GameObject WeaponShotgunPrefabRef;

    public GameObject WeaponRiflePrefabRef;

    public static GameObject WeaponLocation;

    public static GameObject WeaponRopePrefab;

    private static GameObject WeaponShotgunPrefab;

    private static GameObject WeaponRiflePrefab;

    private Player _player;

    private  WeaponUpgradedStat _weaponStatRope;

    private  WeaponUpgradedStat _weaponStatShotgun;

    private  WeaponUpgradedStat _weaponStatRifle;

    private Vector2 _weaponPosVector;

    private Quaternion _weaponRot;

    public enum eWeaponState







    public struct WeaponUpgradedStat


        int UpgradedLevel;


    public void Start()



        if (!_player)


        // equip default weapon, that is Rope

        _player.EquipWeaponPrefab(WeaponRopePrefab, “Rope”);

        WeaponLocation = _player.WeaponLocation;


        _weaponPosVector = WeaponLocation.transform.position;

        _weaponRot = new Quaternion(0000);

        // load weapon prefabs

        WeaponRopePrefab = (GameObject)Instantiate( WeaponRopePrefabRef, _weaponPosVector, _weaponRot);

        //WeaponShotgunPrefab = (GameObject)Instantiate( WeaponShotgunPrefabRef, _weaponPosVector, _weaponRot);

        //WeaponRiflePrefab = (GameObject)Instantiate( WeaponRiflePrefabRef, _weaponPosVector, _weaponRot);

        // set the loaded stats to weapon



    public void LoadWeaponsStatsFromDevice()


        // call Save load weapons to fill in the upgraded stats of each weapon


    public void SetWeaponPrefabStats()


        // set properties of all weapons prefab according to the loaded stats

        Rope rope = WeaponRopePrefab.GetComponent<Rope>();

        // set all properties of rope according to the loaded stats


    public void EquipWeapon(string WeaponName)


        // if rope icon touched

        if (WeaponName == “Rope” )


            _player.EquipWeaponPrefab(WeaponRopePrefab, WeaponName);



    public void GetPlayer()


        _player = AnimalSpawnManager.PlayerPrefab.GetComponent<Player>();



Thanks for reading.

if you want to check out some of our projects please subscribe to our YouTube channel:

You can check up our work in progress games here:

If you are looking for solutions to game development issues see our blogs here:

If you like our projects please sign up for our newsletter at the bottom of this Page.

Leave a Reply