public bool AddWeapon(WeaponData weapon, int index = -1)
 {
     if ((index == -1 || index == 0) && weaponPrimary == null)
     {
         weaponPrimary      = Instantiate(weapon.prefab).GetComponent <WeaponSystem>();
         weaponPrimary.name = weapon.name;
         weaponPrimary.Initialize(weapon);
         weaponPrimary.PickupWeapon(defaultWeaponPos, 0);
         LoadoutManager.instance.InitializeWeapon(weaponPrimary, 0);
         SetWeaponActive(weaponPrimary, false);
     }
     else if ((index == -1 || index == 1) && weaponSecondary == null)
     {
         weaponSecondary      = Instantiate(weapon.prefab).GetComponent <WeaponSystem>();
         weaponSecondary.name = weapon.name;
         weaponSecondary.Initialize(weapon);
         weaponSecondary.PickupWeapon(defaultWeaponPos, 1);
         LoadoutManager.instance.InitializeWeapon(weaponSecondary, 1);
         SetWeaponActive(weaponSecondary, false);
     }
     else if ((index == -1 || index == 2) && weaponSidearm == null)
     {
         weaponSidearm      = Instantiate(weapon.prefab).GetComponent <WeaponSystem>();
         weaponSidearm.name = weapon.name;
         weaponSidearm.Initialize(weapon);
         weaponSidearm.PickupWeapon(defaultWeaponPos, 2);
         LoadoutManager.instance.InitializeWeapon(weaponSidearm, 2);
         SetWeaponActive(weaponSidearm, false);
     }
     else
     {
         return(false);
     }
     return(true);
 }
        public override void Spawn(Vector3 spawnPoint)
        {
            base.Spawn(spawnPoint);

            Brain.RemoveAllSubgoals();
            TargetingSystem.ClearTarget();
            WeaponSystem.Initialize();
            RestoreHealthToMaximum();
        }
Beispiel #3
0
    protected virtual void AddWeapon(WeaponData data)
    {
        WeaponSystem newWeapon = Instantiate(data.prefab).GetComponent <WeaponSystem>();

        newWeapon.name = data.name;
        newWeapon.Initialize(data);
        newWeapon.PickupWeapon(gunArm, weapons.Count);
        newWeapon.gameObject.SetActive(false);
        weapons.Add(newWeapon);
    }
 public void Initialize(Controller controller)
 {
     VehicleHealth.Initialize(controller.ShootDown);
     Weapons.Initialize();
     this.controller = controller;
 }
Beispiel #5
0
 public void Initialize(Controller controller)
 {
     Health.Initialize(Destroy);
     Weapons.Initialize();
     this.controller = controller;
 }