override protected void fire() { GameObject grenade = grenadeManager.getFirstObjectAvailable(); DelayProjectille projectille = grenade.GetComponent <DelayProjectille> (); projectille.transform.position = gun.transform.position + gun.transform.up * 0.4f; projectille.setGunner(tower); projectille.damage = damage; projectille.lifeDistance = range; projectille.GetComponent <Rigidbody> ().velocity = gun.transform.up * impulsionForce; }
override protected void fire() { GameObject missile = missileManager.getFirstObjectAvailable(); GuidedProjectille projectille = missile.GetComponent <GuidedProjectille> (); projectille.transform.position = gun.transform.position; projectille.setGunner(tower); projectille.damage = damage; projectille.target = target; projectille.lifeDistance = range; projectille.setDirection(gun.transform.up); }
public uint Play(string soundname, KeyValuePair <string, object>[] options) { if (!soundMap.ContainsKey(soundname)) { Debug.LogWarning("SoundManager: Tried to play undefined sound: " + soundname); return(0); } if (soundOn) { GameObject audioObject = audioSources.getFirstObjectAvailable(); if (audioObject != null) { AudioSourcePoolable audioPoolable = audioObject.GetComponent <AudioSourcePoolable>(); foreach (KeyValuePair <string, object> option in options) { switch (option.Key) { case "volume": audioPoolable.volume = (float)option.Value; break; case "priority": audioPoolable.priority = (int)option.Value; break; case "pitch": audioPoolable.pitch = (float)option.Value; break; case "loop": audioPoolable.loop = (bool)option.Value; break; case "groupMixer": audioPoolable.outputAudioMixerGroup = (AudioMixerGroup)option.Value; break; } } audioPoolable.Play(soundMap[soundname].getSound()); //audioPoolable.PlayOneShot(soundMap[soundname], audioPoolable.volume); //audioPoolable.PlayOneShot(sound, audioPoolable.volume); //audio.transform } } return(0); }
// Update is called once per frame void Update() { if (Time.time > nextSpawn && spawning) { nextSpawn = Time.time + 1 / spawnPerSecond; GameObject enemy = enemyPooling.getFirstObjectAvailable(); enemy.GetComponent <Enemy>().PV = spawnPV; Vector3 colliderSize = spawnArea.GetComponent <BoxCollider>().size; Vector3 variance = new Vector3( Random.Range(-colliderSize.x, -colliderSize.x), Random.Range(-colliderSize.y, -colliderSize.y), Random.Range(-colliderSize.z, -colliderSize.z) ); enemy.transform.position = spawnArea.transform.position + variance; } }