// Update is called once per frame void Update() { if (this.gameObject.CompareTag("Player1")) { if (Input.GetKeyDown(KeyCode.Keypad0) && !spawned) { GameObject bullet = Resources.Load("Bullet") as GameObject; leanObj.Spawn(p1fire.position, transform.rotation); //bullet.transform.position = new Vector3(0, 10, 0); leanObj.Despawn(bullet, 2f); spawned = true; FindObjectOfType <AudioManager>().Fire(); triggerDelay = 1; } } else if (this.gameObject.CompareTag("Player2")) { Transform parent = GameObject.FindGameObjectWithTag("Player2").transform; if (Input.GetKeyDown(KeyCode.Space) && !spawned) { GameObject bullet = Resources.Load("Bullet") as GameObject; leanObj.Spawn(p1fire.position, transform.rotation); //bullet.transform.position = new Vector3(0,10,0); leanObj.Despawn(bullet, 2f); spawned = true; FindObjectOfType <AudioManager>().Fire(); triggerDelay = 1; } } Reset(); }
public void OnCardStateChanged(CardController card, CardState newState) { switch (newState) { case CardState.Dead: // Animate and destroy the view. transform.DOMoveY(1.0f, 1.0f).onComplete += () => { _pool.Despawn(gameObject); }; break; } }
public void Despawn(GameObject go) { go.transform.localScale = Vector3.one; _pool.Despawn(go); _playerControlledObjectCount--; if (_playerControlledObjectCount == 0) { GameController.Instance.StartCoroutine(WaitAndCheckForPlayerControlledObjects()); } }
//public IEnumerator Test() //{ // AudioController.instance.PlayMusic( "1" ); // while (true) // { // yield return new WaitForSeconds( 0.2f ); // AudioController.instance.PlaySound( "1" ); // } //} private void PlayClip(AudioClip clip, GameObject audioItemObject, bool isMusic = false) { var audioItemSrc = audioItemObject.GetComponent <AudioSource>(); audioItemSrc.clip = clip; audioItemSrc.Play(); if (isMusic) { LeanPool.Despawn(audioItemSrc.gameObject, clip.length); } else { soundPool.Despawn(audioItemSrc.gameObject, clip.length); } }
public void DespawnBombHexagon(BombHexagon bombHexagon) { bombHexagonPool.Despawn(bombHexagon.gameObject); }
public void DespawnHexagon(Hexagon hexagon) { hexagonPool.Despawn(hexagon.gameObject); }
public void DespawnExplodeParticle(ExplodeParticle explodeParticle) { explodeParticlePool.Despawn(explodeParticle.gameObject); }