public int Reload(AmmoInventory ammo) { int ammoRequested = magazineSize - currentMagazine; int loadMagazine = ammo.Spend(ammoType, ammoRequested); return(loadMagazine); }
protected override void PickUpAction() { base.PickUpAction(); AmmoInventory ammoInventory = _player.GetComponent <AmmoInventory>(); ammoInventory.Collect(ammo, ammoAmount); }
private void Start() { if (!AmmoInventory) { AmmoInventory = GetComponentInParent <AmmoInventory>(); } if (!_playerScore) { _playerScore = FindObjectOfType <PlayerScore>(); } }
public override void Awake() { base.Awake(); ammoInventory = transform.root.gameObject.GetComponent <AmmoInventory>(); ammoHUD = GameObject.Find("/HUDCanvas/AmmoUI/AmmoDisplay").GetComponent <Text>(); magazineHUD = GameObject.Find("/HUDCanvas/AmmoUI/MagazineDisplay").GetComponent <Text>(); FSM = new FiniteStateMachine <ProjectileWeapon>(); FSM.Configure(this, WeaponIdleState.Instance); Debug.Log("Weapon Attached. Awake"); }
private void Awake() { navMeshAgent = GetComponent <NavMeshAgentController>(); /* Set States */ states = new Dictionary <EnemySatate, EnemyStateBase>(); states.Add(EnemySatate.Patrol, new PatrolState(this)); states.Add(EnemySatate.Alert, new AlertState(this)); states.Add(EnemySatate.Chase, new ChaseState(this)); states.Add(EnemySatate.Fire, new FireState(this)); currentState = states[EnemySatate.Patrol]; orginalPosition = transform.position; player = GameObject.FindGameObjectWithTag("Player").transform; if (Fire) { ammo = GetComponent <AmmoInventory>(); } }
void Start() { playerInventory = GameObject.FindWithTag("Player").GetComponent <AmmoInventory>(); Invoke("SpwanPower", AverageSpawnTime + Random.value * variance); }
public bool Fire(AmmoInventory ammo) { int shotsfired = ammo.Spend(ammoType, ammoPerShot); return(shotsfired > 0); }
void Awake() { ThisInventory = GetComponent <AmmoInventory>(); }