Ejemplo n.º 1
0
    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;
                }
            }
        }
    }
Ejemplo n.º 2
0
    private List <GameObject> pickUpList;    //store deactive pickup object list

    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
    }
Ejemplo n.º 3
0
 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);
    }
Ejemplo n.º 5
0
 void Start()
 {
     roadSpawner        = GetComponent <RoadSpawner>();
     carSpawner         = GetComponent <CarSpawner>();
     pickUpSpawner      = GetComponent <PickUpSpawner>();
     enemySpawner       = GetComponent <EnemySpawner>();
     environmentSpawner = GetComponent <EnvironmentSpawn>();
 }
Ejemplo n.º 6
0
 private void Awake()
 {
     if (_instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         _instance = this;
     }
 }
Ejemplo n.º 7
0
    // 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;
        }
    }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     t = GetComponent <Transform>();
     pickUpSpawnerScript = GameObject.Find("PickUp Spawner").GetComponent <PickUpSpawner>();
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     current = this;
 }
Ejemplo n.º 10
0
 public void AssignSpawner(PickUpSpawner sickUpSpawner)
 {
     spawner = sickUpSpawner;
 }