private SpringJoint2D _spring; // The spring joint that will hold the projectile inside the specified radius #endregion Fields #region Methods /// <summary> /// Called when this object is active in the physics simulation /// </summary> void Awake() { // Get the catapult transform as soon as the physics simulation for this object starts _spring = GetComponent <SpringJoint2D> (); _catapult = _spring.connectedBody.transform; _sounds = GameObject.Find("LC").GetComponent<SoundAssets>(); }
// Use this for initialization void Start() { _sounds = GameObject.Find("LC").GetComponent<SoundAssets>(); _dispenser = GameObject.Find("Dispenser").GetComponent<DispenserController>(); _timeCounter = GetComponent<TimeCounter>(); var audioSource = _dispenser.gameObject.GetComponent<AudioSource>(); _lvlText = GameObject.Find("txtLevel").GetComponent<Text>(); // Find the level text object if it exists and update it with the current level count. // Remember: Scenes "0" and "1" are SplashScreen and MainMenu so the first lvl has the index "2"! _lvlText.text = "Level " + (Application.loadedLevel - 1); audioSource.PlayOneShot(_sounds.LevelStart); _secToStart = LevelStartTime; StartCoroutine("WaitOne"); }
void Start() { // Get the SoundEffect storage _sounds = GameObject.Find("LC").GetComponent<SoundAssets>(); // Get the SpriteRenderer component for the GameObject's Rigidbody _spriteRenderer = GetComponent <SpriteRenderer> (); // Get the attached AudioSource compoenent _aSource = GetComponent<AudioSource>(); // Initialize the Hit Points _currentHitPoints = HitPoints; // Calculate the Damage Impact Speed Squared from the Damage Impact Speed _damageImpactSpeedSqr = DamageImpactSpeed * DamageImpactSpeed; }
public static void AddAudio(GameClient game) { Systems.sounds = new SoundAssets(game); Systems.music = new MusicAssets(game); }
private void Awake() { instance = this; }
// Use this for initialization void Start() { _aSource = GetComponent<AudioSource>(); _sounds = GameObject.Find("LC").GetComponent<SoundAssets>(); }