despawn() публичный статический Метод

sticks the GameObject back into its recycle bin. If the GameObject has no bin it is destroyed.
public static despawn ( GameObject go ) : void
go GameObject Go.
Результат void
    // Update is called once per frame
    void Update()
    {
        try
        {
            boss   = GameObject.FindGameObjectWithTag("Enemy");
            muzzle = boss.GetComponent <scriptBoss2>().muzzle;
        }
        catch (NullReferenceException)
        {
            Debug.Log("não encontrad");
        }

        count += 1 * Time.deltaTime;
        if (count > 3f)
        {
            Vector3    positionToSpawn = muzzle.transform.position + new Vector3(0, 2f, 0);
            GameObject parentToFlame   = TrashMan.spawn("Flame_Green_Attack1", positionToSpawn, muzzle.transform.rotation);
            parentToFlame.transform.parent = gameObject.transform.parent;
            positionToSpawn = new Vector3(0, 0, 0);
            count           = 0;
            TrashMan.despawn(gameObject);
        }

        /*
         * if(!particleSys.IsAlive())
         * {
         *  Vector3 positionToSpawn = gameObject.transform.position + new Vector3(0, 2f, 0);
         *  GameObject parentToFlame = TrashMan.spawn("Flame_Green_Attack1",positionToSpawn);
         *  parentToFlame.transform.parent = gameObject.transform.parent;
         *  positionToSpawn = new Vector3(0, 0, 0);
         *  TrashMan.despawn(gameObject);
         *
         * }*/
    }
    // Token: 0x060070A5 RID: 28837 RVA: 0x00233BF8 File Offset: 0x00231DF8
    private IEnumerator MHFHLKNAELL(GameObject OBFJPHLBFOL, float DKKOANEPOEI)
    {
        yield return(new WaitForSeconds(DKKOANEPOEI));

        TrashMan.despawn(OBFJPHLBFOL);
        yield break;
    }
Пример #3
0
    IEnumerator despawn()
    {
        yield return(new WaitForSeconds(5f));

        isAttached = false;
        TrashMan.despawn(gameObject);
    }
Пример #4
0
 void Update()
 {
     if (audioSource && !audioSource.isPlaying)
     {
         TrashMan.despawn(this.gameObject);
     }
 }
Пример #5
0
    void FixedUpdate()
    {
        float moveDistance = speed * Time.deltaTime;

        count += 1 * Time.deltaTime;


        speed = 30f;

        transform.Translate(Vector2.up * moveDistance);



        //Parte que procura a câmera e pega o componente script CameraShake
        GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");

        cam = camSearch.GetComponent <CameraShake>();

        //Movimentação do projétil
        if (count > 0.7f)
        {
            count = 0;
            TrashMan.despawn(gameObject);
        }
    }
Пример #6
0
    IEnumerator destruction()
    {
        canShoot = false;
        CapsuleCollider2D colliderPlayer = target.GetComponent <CapsuleCollider2D>();

        colliderPlayer.enabled = false;

        Camera.main.GetComponent <CameraShake>().Shake(1f, 3f, 3f);



        yield return(new WaitForSeconds(6f));

        colliderPlayer.enabled = true;

        yield return(new WaitForSeconds(10f));


        enemyManager.updateEnemy();
        enemyManager.needToSpawnEnemy = true;
        dead   = false;
        health = startingHealth;

        TrashMan.despawn(gameObject);
    }
Пример #7
0
    public void Explode(Vector3 pos, Quaternion rotation, bool shouldDestroy)
    {
        if (ExplodeClip && _LastAudioPlay + 0.4f < Time.unscaledTime)
        {
            _LastAudioPlay = Time.unscaledTime;
            Music.PlayClipAtPoint(ExplodeClip, pos, Music.instance.sfxv, Random.Range(0.50f, 1.50f), SoundSource);
        }

        for (int i = 0; i < Explosions.Length; i++)
        {
            TrashMan.spawn(Explosions[i], pos, rotation);
        }

        if (!shouldDestroy)
        {
            return;
        }

        if (Spawner != null)
        {
            Spawner.Despawn(gameObject);
        }
        else
        {
            TrashMan.despawn(gameObject);
        }
    }
Пример #8
0
    public virtual void SpawnNewShield(string _typeOfShield)
    {
        if (shield == null)
        {
            GameObject newShield;
            newShield = TrashMan.spawn(_typeOfShield, shieldMuzzle.position, shieldMuzzle.rotation);
            shield    = newShield;
        }
        else
        {
            TrashMan.despawn(shield);
            GameObject newShield;
            newShield = TrashMan.spawn(_typeOfShield, shieldMuzzle.position, shieldMuzzle.rotation);
            shield    = newShield;
        }

        if (GameObject.FindGameObjectWithTag("red"))
        {
            shieldColor = shield.GetComponent <ParticleSystem>();
            ParticleSystem.MainModule mainShield = shieldColor.main;
            mainShield.startColor = new Color(1.00000f, 0.23529f, 0.23529f);
        }

        if (GameObject.FindGameObjectWithTag("green"))
        {
            shieldColor = shield.GetComponent <ParticleSystem>();
            ParticleSystem.MainModule mainShield = shieldColor.main;
            mainShield.startColor = new Color(0.23529f, 1.00000f, 0.55686f);
        }

        shield.transform.parent = gameObject.transform;
    }
Пример #9
0
 public void die()
 {
     m_manager.changeStateOfCombat(false);
     healthBarImage.fillAmount = 0;
     OuterHealthBar.SetActive(false);
     TrashMan.despawn(gameObject);
 }
Пример #10
0
    public virtual void Die()
    {
        dead = true;

        if (OnDeath != null)
        {
            OnDeath();
        }


        GameObject canvasGameOver = managerGetVariables.canvasGameOver;

        canvasGameOver.SetActive(true);

        sceneManager = GameObject.FindGameObjectWithTag("SceneManager");

        ManagerScene manageSceneVariableChanger = sceneManager.GetComponent <ManagerScene>();

        manageSceneVariableChanger.isPlayerAlive = false;



        TrashMan.despawn(gameObject);
        dead   = false;
        health = 3;
    }
Пример #11
0
    void FixedUpdate()
    {
        count += 1 * Time.deltaTime;
        //Parte que procura a câmera e pega o componente script CameraShake
        try
        {
            GameObject camSearch = GameObject.FindGameObjectWithTag("MainCamera");
            cam = camSearch.GetComponent <CameraShake>();

            managerScene        = GameObject.FindGameObjectWithTag("SceneManager");
            sceneManagerUpdated = managerScene.GetComponent <ManagerScene>();
        }
        catch (NullReferenceException)
        {
            Debug.Log("não encontrado");
        }

        //Movimentação do projétil
        float moveDistance = speed * Time.deltaTime;

        transform.Translate(Vector2.down * moveDistance);

        if (count > 5)
        {
            count = 0;
            TrashMan.despawn(gameObject);
        }
    }
Пример #12
0
 void despawn()
 {
     valid     = false;
     collision = false;
     rTran.anchoredPosition = Vector2.zero;
     TrashMan.despawn(this.gameObject);
 }
Пример #13
0
 public void ReturnToPool(GameObject go)
 {
     for (int p = 0; p < poolActive.Count; p++)
     {
         TrashMan.despawn(poolActive[p]);
         poolActive.RemoveAt(p);
     }
 }
Пример #14
0
        public override void Die()
        {
            GameManager.Win();

            TrashMan.despawn(healthGO);
            base.Die();
            StartCoroutine(RemoveBody());
        }
Пример #15
0
    protected IEnumerator OnCollisionEnter()
    {
        this.target.SetActive(false);
        this.animator.SetTrigger("DidCrash");
        yield return(new WaitForSeconds(0.5f));

        TrashMan.despawn(this.transform.parent.gameObject);
    }
Пример #16
0
        void CheckForDeath()
        {
            this.currentBounces++;

            if (this.currentBounces == this.bouncesToDestroy)
            {
                TrashMan.despawn(this.gameObject);
            }
        }
Пример #17
0
 public void OnPass()
 {
     if (!enemy.isDie)
     {
         enemy.isDie = true;
         TrashMan.despawn(this.gameObject);
         Game.Me.ReportPass(enemy);
     }
 }
 private IEnumerator Die()
 {
     //Instantiate particles
     Instantiate(_particleSystem, this.transform.position, Quaternion.identity);
     gameObject.SetActive(false);
     TrashMan.despawn(gameObject);
     _gameController.IncreaseScore();
     yield break;
 }
Пример #19
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag.CompareTo(ObjectType.PlayerBullet) == 0)
     {
         start = false;
         TrashMan.despawn(this.gameObject);
         return;
     }
 }
Пример #20
0
    public void Remove()
    {
        Block block = blocks.Dequeue();

        block.gameObject.transform.parent = null;
        TrashMan.despawn(block.gameObject);

        this.levelGenerator.CreateOne();
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.GetComponent <BaseShip>() != null)
     {
         manager.changeStateOfCombat(true);
         Debug.Log("State of combat: " + manager.stateOfCombat);
         TrashMan.despawn(gameObject);
     }
 }
Пример #22
0
 public void OnPass()
 {
     if (!protestante.isDie)
     {
         protestante.isDie = true;
         TrashMan.despawn(this.gameObject);
         Game.Me.OnProtestantePass(protestante);
     }
 }
 public override void OnDisable()
 {
     TrashMan.despawn(vfxInstance);
     if (target != null)
     {
         target.tauntTarget = null;
     }
     base.OnDisable();
 }
Пример #24
0
 public void delAllBallView()
 {
     for (int i = 0; i < listBallView.Count; i++)
     {
         BallView ball = listBallView[i];
         TrashMan.despawn(ball.gameObject);
     }
     listBallView.Clear();
 }
Пример #25
0
    void Update()
    {
        m_enemiesInChildren = transform.childCount;

        if (m_enemiesInChildren <= 0)
        {
            m_sceneManager.changeStateOfCombat(false);
            TrashMan.despawn(gameObject);
        }
    }
Пример #26
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag.CompareTo(ObjectType.EnemyBullet) == 0)
     {
         NetObject netObject = NetScene.getInstance().GetBall(uid);
         netObject.isDead = true;
         TrashMan.despawn(this.gameObject);
         return;
     }
 }
Пример #27
0
        public override void Die()
        {
            foreach (var players in GameManager.PlayersInGame)
            {
                players.hero.Heal(healAmount);
            }

            TrashMan.despawn(healthGO);
            base.Die();
            StartCoroutine(RemoveBody());
        }
        public override void ActivateUp()
        {
            SCollider.enabled = false;

            base.ActivateUp();

            if (tauntInstance != null)
            {
                TrashMan.despawn(tauntInstance);
            }
        }
Пример #29
0
 // when the item is used
 public virtual void OnUse()
 {
     if (limitedUses)
     {
         numberOfUses -= 1;
         if (numberOfUses <= 0)
         {
             TrashMan.despawn(gameObject);
         }
     }
 }
Пример #30
0
    public void OnDie()
    {
        if (!protestante.isDie)
        {
            protestante.isDie = true;

            TrashMan.despawn(this.gameObject);

            Game.Me.OnGameOver();
        }
    }