private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { WeaponBehaviour _weaponScript = other.GetComponentInChildren(typeof(WeaponBehaviour)) as WeaponBehaviour; PickUpSpawner _spawnerScript = GameObject.Find("PickUpSpawner").GetComponent(typeof(PickUpSpawner)) as PickUpSpawner; if (_weaponScript != null) { if (_weaponScript.GetCurrentAmmo() != _weaponScript.GetMaxAmmo()) { _weaponScript.RefillAmmo(); if (_spawnerScript != null) { _spawnerScript.PickUpCollected(); } Destroy(this.gameObject); } else { _hasDamaged = true; } } } }
private List <GameObject> pickUpList; //store deactive pickup object list private void Awake() { if (instance == null) { instance = this; } }
void Start() { pickUpSpawner = GetComponent <PickUpSpawner>(); enemyHealth = enemy.GetComponent <EnemyHealth>(); canIncreaseScore = false; startingScore = 0; currentScore = startingScore; }
public override void OnKilled() { Object blood = Instantiate(BloodSplatter, transform.position, Quaternion.LookRotation(_gotHinInDirection)); PickUpSpawner expSpawner = GameObject.FindObjectOfType(typeof(PickUpSpawner)) as PickUpSpawner; expSpawner.SpawnEnemyDrops(transform.position); Destroy(gameObject); }
void Start() { roadSpawner = GetComponent <RoadSpawner>(); carSpawner = GetComponent <CarSpawner>(); pickUpSpawner = GetComponent <PickUpSpawner>(); enemySpawner = GetComponent <EnemySpawner>(); environmentSpawner = GetComponent <EnvironmentSpawn>(); }
private void Awake() { if (_instance != null) { Destroy(gameObject); } else { _instance = this; } }
// Start is called before the first frame update void Start() { Debug.Log("Randomizer Active"); spawner = gameObject.GetComponentInParent <PickUpSpawner>(); CharPickUp = gameObject.transform.GetChild(0).gameObject; NitroPickUp = gameObject.transform.GetChild(1).gameObject; TirePickUp = gameObject.transform.GetChild(2).gameObject; int r = Random.Range(0, 3); switch (r) { case 0: setPickUpType(PickUpType.Tires); break; case 1: setPickUpType(PickUpType.Nitro); break; case 2: setPickUpType(PickUpType.Character); break; } }
// Use this for initialization void Start() { t = GetComponent <Transform>(); pickUpSpawnerScript = GameObject.Find("PickUp Spawner").GetComponent <PickUpSpawner>(); }
private void Awake() { current = this; }
public void AssignSpawner(PickUpSpawner sickUpSpawner) { spawner = sickUpSpawner; }