Beispiel #1
0
 // 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();
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
    public void Despawn(GameObject go)
    {
        go.transform.localScale = Vector3.one;
        _pool.Despawn(go);
        _playerControlledObjectCount--;

        if (_playerControlledObjectCount == 0)
        {
            GameController.Instance.StartCoroutine(WaitAndCheckForPlayerControlledObjects());
        }
    }
Beispiel #4
0
    //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);
        }
    }
Beispiel #5
0
 public void DespawnBombHexagon(BombHexagon bombHexagon)
 {
     bombHexagonPool.Despawn(bombHexagon.gameObject);
 }
Beispiel #6
0
 public void DespawnHexagon(Hexagon hexagon)
 {
     hexagonPool.Despawn(hexagon.gameObject);
 }
Beispiel #7
0
 public void DespawnExplodeParticle(ExplodeParticle explodeParticle)
 {
     explodeParticlePool.Despawn(explodeParticle.gameObject);
 }