spawn() public static method

pulls an object out of the recycle bin
public static spawn ( GameObject go, Vector3 position = default(Vector3), Quaternion rotation = default(Quaternion) ) : GameObject
go GameObject Go.
position Vector3
rotation Quaternion
return GameObject
Esempio n. 1
0
    public GameObject GetExplosion(Vector3 pos)
    {
        GameObject explosion = TrashMan.spawn("explo_1", pos);

        this.poolActive.Add(explosion);
        return(explosion);
    }
Esempio n. 2
0
    public GameObject GetTile()
    {
        GameObject tile = TrashMan.spawn("tile");

        this.poolActive.Add(tile);
        return(tile);
    }
    private void SpawnTarget(Vector3 position, float score)
    {
        GameObject     target         = TrashMan.spawn(targetPrefab, position);
        TargetCollider targetCollider = target.GetComponent <TargetCollider>();

        targetCollider.Score = score;
    }
Esempio n. 4
0
    void GenerateBullet()
    {
        GameObject bullet = TrashMan.spawn("fire_bullet", spawningPoint.position);

        bullet.transform.rotation = spawningPoint.rotation;
        bullet.GetComponent <Bullet>().Initialize(block);
    }
Esempio n. 5
0
    public void spawnEnemy(int enemyInOrder)
    {
        switch (enemyInOrder)
        {
        case 0:
            TrashMan.spawn("Enemy1", muzzleEnemies.transform.position, muzzleEnemies.transform.rotation);
            break;

        case 1:
            TrashMan.spawn("Boss1", muzzleEnemies.transform.position, muzzleEnemies.transform.rotation);
            break;

        case 2:
            TrashMan.spawn("Boss2", muzzleEnemies.transform.position, muzzleEnemies.transform.rotation);
            break;

            /*
             * case 1:
             *  break;
             * case 1:
             *  break;
             * case 1:
             *  break;
             * case 1:
             *  break;
             */
        }
    }
Esempio n. 6
0
    void OnRekComboIncreased(GameObject obj, int combo)
    {
        if (_LastComboText + 0.5f >= Time.unscaledTime)
        {
            return;
        }
        if (Random.Range(0f, 1f) > 0.7f)
        {
            return;
        }
        List <ComboTextData> valid = new List <ComboTextData>();

        for (int i = 0; i < ComboData.Length; i++)
        {
            if (combo >= ComboData[i].MinCombo && combo <= ComboData[i].MaxCombo)
            {
                valid.Add(ComboData[i]);
            }
        }

        if (valid.Count > 0)
        {
            ComboTextData comboData  = valid[Random.Range(0, valid.Count)];
            Vector2       unitCircle = Random.insideUnitCircle * ComboTextCircleSize;
            Vector2       pos        = (Vector2)obj.transform.position + unitCircle + new Vector2(0, ComboTextYOffset);

            DialogSystem.Instance.AddDialog(ComboDialog, 0f, 0.15f);
            TrashMan.spawn(comboData.Prefab, new Vector3(pos.x, pos.y, 30));
            GameLogic.Instance.AddScore(RekCombo.ComboScore);
            _LastComboText = Time.unscaledTime;
        }
    }
Esempio n. 7
0
    // Token: 0x0600E1AE RID: 57774 RVA: 0x00513A94 File Offset: 0x00511C94
    public GameObject AJNCBGCPIIF(GameObject GEKFKCKDBOM, Vector3 JOPCODOJBHD, Quaternion LOMLCCLOIKN, int KEMDFEFBIOC)
    {
        if (KEMDFEFBIOC == 0)
        {
            KEMDFEFBIOC = 1;
        }
        GameObject gameObject = TrashMan.spawn(GEKFKCKDBOM, JOPCODOJBHD, LOMLCCLOIKN);

        gameObject.transform.SetParent(this.pbase.playerController.objects[KEMDFEFBIOC].transform);
        if (gameObject.GetComponent <MoveF>())
        {
            gameObject.GetComponent <MoveF>().enabled = true;
        }
        if (gameObject.GetComponent <Collider>())
        {
            gameObject.GetComponent <Collider>().enabled = true;
        }
        if (gameObject.GetComponent <SegmentHandler>())
        {
            gameObject.GetComponent <SegmentHandler>().CFKJHLOEDFO(this.pbase);
        }
        if (gameObject.GetComponent <IncreseAlpha>())
        {
            gameObject.GetComponent <IncreseAlpha>().EMOCEKPLGBK();
        }
        return(gameObject);
    }
Esempio n. 8
0
        // Similar to the damaged method, but gets it's own method for ease of use.
        public virtual void Heal(float heal)
        {
            if (StatsComponent.HealthCurrent + heal > StatsComponent.HealthMax)
            {
                StatsComponent.HealthCurrent = StatsComponent.HealthMax;
            }
            else
            {
                StatsComponent.HealthCurrent += heal;
            }

            //spawn heal effect
            if (healEffect != null)
            {
                GameObject heals = TrashMan.spawn(healEffect, transform.position + healEffectOffset, Quaternion.identity);
                heals.transform.SetParent(transform);
            }
            if (damagePrefab != null)
            {
                //spawn damage number indicator
                Vector3 screenPoint = RectTransformUtility.WorldToScreenPoint(Camera.main, transform.position);
                var     damageGO    = TrashMan.spawn(damagePrefab, screenPoint, Quaternion.identity);
                damageGO.gameObject.SetActive(true);
                damageGO.GetComponent <RectTransform>().SetParent(UIManager.Instance.WorldUi.transform);
                damageGO.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1);

                damageGO.gameObject.GetComponentInChildren <Text>().text  = Mathf.Floor(heal).ToString();
                damageGO.gameObject.GetComponentInChildren <Text>().color = Color.green;
            }
        }
Esempio n. 9
0
    public void CreateLootCookie(Block block)
    {
        GameObject lootCoin = TrashMan.spawn("lootCookie");

        lootCoin.transform.position = block.transform.position;
        lootCoin.GetComponent <LotCookie>().Initialize(block);
    }
Esempio n. 10
0
    // Token: 0x0600E1AC RID: 57772 RVA: 0x0051394C File Offset: 0x00511B4C
    public GameObject PGKPDOKAKPB(GameObject GEKFKCKDBOM, Vector3 JOPCODOJBHD, Quaternion LOMLCCLOIKN, int KEMDFEFBIOC)
    {
        if (KEMDFEFBIOC == 0)
        {
            KEMDFEFBIOC = 0;
        }
        GameObject gameObject = TrashMan.spawn(GEKFKCKDBOM, JOPCODOJBHD, LOMLCCLOIKN);

        gameObject.transform.SetParent(this.pbase.playerController.objects[KEMDFEFBIOC].transform);
        if (gameObject.GetComponent <MoveF>())
        {
            gameObject.GetComponent <MoveF>().enabled = false;
        }
        if (gameObject.GetComponent <Collider>())
        {
            gameObject.GetComponent <Collider>().enabled = true;
        }
        if (gameObject.GetComponent <SegmentHandler>())
        {
            gameObject.GetComponent <SegmentHandler>().PAFMNAIDAFH(this.pbase);
        }
        if (gameObject.GetComponent <IncreseAlpha>())
        {
            gameObject.GetComponent <IncreseAlpha>().Init();
        }
        return(gameObject);
    }
Esempio n. 11
0
    public GameObject CreateLaser(Block block)
    {
        if (UpgradesMan.Instance.HasRuinLasersEnable)
        {
            int prob = Random.Range(0, 100);
            //TODO: ESTO ESTA HARCODEADO se debe cargar a partir del nivel del upgrade
            if (prob > 10)
            {
                Debug.Log("salvado por el ruin laser");
                return(null);
            }
        }

        int        r = Random.Range(3, 5);
        GameObject internalHazard = TrashMan.spawn(
            Game.Instance.gameWeights.chimney_normal_hazards[r].name,
            this.transform.position);

        internalHazard.transform.eulerAngles = Vector3.zero;
        int probRotation = Random.Range(0, 100);

        if (probRotation < 50)
        {
            internalHazard.transform.rotation = Quaternion.Euler(0, 45, 0);
        }
        else
        {
            internalHazard.transform.rotation = Quaternion.Euler(0, -45, 0);
        }

        internalHazard.GetComponent <BlockElement>().Initialize(block);

        return(internalHazard);
    }
Esempio n. 12
0
    public override void OnInitialize()
    {
        if (Random.Range(0, 100) < 50)
        {
            this.GetComponent <RotateAnimation>().direction = new Vector3(0, 5, 0);
        }
        else
        {
            this.GetComponent <RotateAnimation>().direction = new Vector3(0, -5, 0);
        }


        this.transform.eulerAngles = new Vector3(0, 0, 0);

        if (Random.Range(0, 100) < 50 && Game.Instance.fallDistanceMeter.meters > 30)
        {
            int num = Random.Range(0, 4);
            for (int i = 0; i < num; i++)
            {
                GameObject cueton = TrashMan.spawn("cueton", positions[i].position);
                block.blockElements.Add(cueton.GetComponent <BlockElement>());
            }
        }

        base.OnInitialize();
    }
Esempio n. 13
0
    void GetNormalFireGun(Block block, Vector3 pos)
    {
        GameObject godefault = TrashMan.spawn(this.nameChildPattern, pos);

        //Debug.Log("euler  " + pattern.transform.eulerAngles);
        godefault.GetComponent <GunFire>().Initialize(block, pattern.direction);
    }
        public override void RaiseEvent(string eventName)
        {
            switch (eventName)
            {
            case "Skill4_CastSmoke":
                var  bombGo = TrashMan.spawn(SmokeBomb, owner.transform.position, Quaternion.identity);
                Bomb bomb   = bombGo.GetComponent <Bomb>();
                bomb.buffDuration = buffDuration;
                bomb.Initialize(owner, owner.enemyFactions);
                OnCast();
                break;

            case "Skill4_Project":
                if (spawnLocations.Count > 0)
                {
                    for (int i = 0; i < numberOfClones; i++)
                    {
                        Vector3 location = owner.transform.position;
                        location += spawnLocations[i];

                        var    clones = TrashMan.spawn(shadowClonesPrefab, location, Quaternion.identity);
                        Turret clo    = clones.GetComponent <Turret>();
                        if (clo != null)
                        {
                            clo.Initialize(owner, clonesDuration, true);
                        }
                    }
                }
                break;
            }
        }
Esempio n. 15
0
    // Token: 0x0600E1B1 RID: 57777 RVA: 0x00513BDC File Offset: 0x00511DDC
    public GameObject DGDDKLNFJDI(GameObject GEKFKCKDBOM, Vector3 JOPCODOJBHD, Quaternion LOMLCCLOIKN, int KEMDFEFBIOC)
    {
        if (KEMDFEFBIOC == 0)
        {
            KEMDFEFBIOC = 0;
        }
        GameObject gameObject = TrashMan.spawn(GEKFKCKDBOM, JOPCODOJBHD, LOMLCCLOIKN);

        gameObject.transform.SetParent(this.pbase.playerController.objects[KEMDFEFBIOC].transform);
        if (gameObject.GetComponent <MoveF>())
        {
            gameObject.GetComponent <MoveF>().enabled = true;
        }
        if (gameObject.GetComponent <Collider>())
        {
            gameObject.GetComponent <Collider>().enabled = true;
        }
        if (gameObject.GetComponent <SegmentHandler>())
        {
            gameObject.GetComponent <SegmentHandler>().PFMJPIJONIP(this.pbase);
        }
        if (gameObject.GetComponent <IncreseAlpha>())
        {
            gameObject.GetComponent <IncreseAlpha>().PIEPPKMBJHI();
        }
        return(gameObject);
    }
Esempio n. 16
0
    public void createTree()
    {
        TrashManRecycleBin bin = new TrashManRecycleBin();

        bin.instancesToPreallocate = 20;
        bin.prefab     = ballPrefab.gameObject;
        ballPrefab.tag = ObjectType.Player;
        TrashMan.manageRecycleBin(bin);
        Rectangle bound = new Rectangle(0, 0, 800, 480);

        quardTree = new QuardTree(bound, 0);
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 10; j++)
            {
                ObjectView objectView = TrashMan.spawn(ballPrefab.gameObject).GetComponent <ObjectView>();
                Rectangle  rect       = new Rectangle(200 + i * 50, 120 + j * 50, 20, 20);
                //Rectangle rect = new Rectangle(i * 50, j * 50, 20, 20);
                objectView.setCollisionHandler(rect);
                //objectView.transform.SetParent(this.transform, false);
                Vector3 localPotion = new Vector3(objectView.rect.center.x, objectView.rect.center.y, 0);
                objectView.transform.localPosition = localPotion;
                quardTree.Insert(objectView.rect);
            }
        }
        drawQuardTree(quardTree);
    }
Esempio n. 17
0
    // Token: 0x0600E1B6 RID: 57782 RVA: 0x00513F28 File Offset: 0x00512128
    public GameObject KEDHNCEBKLE(GameObject GEKFKCKDBOM, Vector3 JOPCODOJBHD, Quaternion LOMLCCLOIKN, int KEMDFEFBIOC)
    {
        if (KEMDFEFBIOC == 0)
        {
            KEMDFEFBIOC = 1;
        }
        GameObject gameObject = TrashMan.spawn(GEKFKCKDBOM, JOPCODOJBHD, LOMLCCLOIKN);

        gameObject.transform.SetParent(this.pbase.playerController.objects[KEMDFEFBIOC].transform);
        if (gameObject.GetComponent <MoveF>())
        {
            gameObject.GetComponent <MoveF>().enabled = true;
        }
        if (gameObject.GetComponent <Collider>())
        {
            gameObject.GetComponent <Collider>().enabled = false;
        }
        if (gameObject.GetComponent <SegmentHandler>())
        {
            gameObject.GetComponent <SegmentHandler>().LBICLFNOLAK(this.pbase);
        }
        if (gameObject.GetComponent <IncreseAlpha>())
        {
            gameObject.GetComponent <IncreseAlpha>().HBKEHHCMMBN();
        }
        return(gameObject);
    }
Esempio n. 18
0
    void Start()
    {
        switch (typeOfSpaceshipBeingUsed)
        {
        case 0:
            TrashMan.spawn("Main_Player_Default", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 1:
            TrashMan.spawn("Main_Player_SecondWind", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 2:
            TrashMan.spawn("Main_Player_Berserk", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 3:
            TrashMan.spawn("Main_Player_Frozen", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 4:
            TrashMan.spawn("Main_Player_Regenerator", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 5:
            TrashMan.spawn("Main_Player_DoubleGold", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;

        case 6:
            TrashMan.spawn("Main_Player_Bombardier", muzzlePlayer.transform.position, muzzlePlayer.transform.rotation);
            break;
        }

        isPlayerAlive = true;
    }
Esempio n. 19
0
    // Token: 0x0600E1A5 RID: 57765 RVA: 0x005134A8 File Offset: 0x005116A8
    public GameObject IKHKPEGCGDH(GameObject GEKFKCKDBOM, Vector3 JOPCODOJBHD, Quaternion LOMLCCLOIKN, int KEMDFEFBIOC)
    {
        if (KEMDFEFBIOC == 0)
        {
            KEMDFEFBIOC = 1;
        }
        GameObject gameObject = TrashMan.spawn(GEKFKCKDBOM, JOPCODOJBHD, LOMLCCLOIKN);

        gameObject.transform.SetParent(this.pbase.playerController.objects[KEMDFEFBIOC].transform);
        if (gameObject.GetComponent <MoveF>())
        {
            gameObject.GetComponent <MoveF>().enabled = true;
        }
        if (gameObject.GetComponent <Collider>())
        {
            gameObject.GetComponent <Collider>().enabled = true;
        }
        if (gameObject.GetComponent <SegmentHandler>())
        {
            gameObject.GetComponent <SegmentHandler>().ALKBNPMCEOM(this.pbase);
        }
        if (gameObject.GetComponent <IncreseAlpha>())
        {
            gameObject.GetComponent <IncreseAlpha>().EJLKPLOEEEP();
        }
        return(gameObject);
    }
Esempio n. 20
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);
        }
    }
Esempio n. 21
0
    public void GenerateCoin()
    {
        Coin coin = TrashMan.spawn("coin", spwPointCoin.position).GetComponent <Coin>();

        coin.Throw();
        StartCoroutine(WaitToGenerate());
    }
Esempio n. 22
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;
    }
Esempio n. 23
0
    public GameObject GetBubble(Vector3 pos)
    {
        GameObject bubble = TrashMan.spawn("bubble", pos);

        this.poolActive.Add(bubble);
        return(bubble);
    }
    IEnumerator SpawnWithPooling()
    {
        yield return(new WaitForSeconds(_startWait));

        for (int i = 0; i < _waveCount; i++)
        {
            //ask the object pool for an available pumpkin. We've limited to 8
            //active at once to help avoid overload of too many tris in our scene.
            var pumpkin = TrashMan.spawn("Pumpkin", _spawnPoints[Random.Range(0, 2)].transform.position);

            //pumpkin may be null if one isn't available from the pool
            if (pumpkin)
            {
                //Reset its properties
                pumpkin.GetComponent <PumpkinController>().Reset();
                //Look at the cross (so we move towards it)
                pumpkin.transform.LookAt(_tombstonePosition);
            }
            else
            {
                Debug.Log(string.Format("A pumpkin was requested from the pool but not available, " +
                                        "potentially a higher wavecount ({0}) than allowed in the pool?",
                                        _waveCount));
            }

            //Sleep
            yield return(new WaitForSeconds(Random.Range(.5f, 2.5f)));
        }
        yield return(new WaitForSeconds(_waveWait));
    }
Esempio n. 25
0
    public GameObject GetPoint(Vector3 pos)
    {
        GameObject point = TrashMan.spawn("point", pos);

        this.poolActive.Add(point);
        return(point);
    }
Esempio n. 26
0
        public override void OnHit(Collider hit)
        {
            Entity entity = hit.gameObject.GetComponent <Entity>();

            if (entity != null)
            {
                if ((owner.enemyFactions & entity.currentFaction) == entity.currentFaction)
                {
                    owner.OnHit(entity, damage);
                    entity.Damage(owner, damage);
                    if (knockback)
                    {
                        Vector3 direction = (entity.transform.position - owner.transform.position).normalized;
                        entity.gameObject.GetComponent <Rigidbody>().AddForce(direction * knockbackForce, ForceMode.Impulse);
                    }


                    var  buff = TrashMan.spawn(stunDebuff, hit.transform.position, Quaternion.identity);
                    Buff stun = buff.GetComponent <Buff>();
                    stun.lifeSpan = stunDuration;
                    stun.Initialize(owner, entity);

                    StartCoroutine(FreezeFrame());
                }
            }
        }
Esempio n. 27
0
    void GetRedLight(Block block, Vector3 pos)
    {
        GameObject redLight = TrashMan.spawn(this.nameChildPattern, pos);

        redLight.GetComponent <BlockElement>().Initialize(block);
        redLight.transform.localEulerAngles = new Vector3(0, 0, 0);
    }
    // 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);
         *
         * }*/
    }
Esempio n. 29
0
    public void spawn()
    {
        //if (!startSpawn)
        //{
        //    return;
        //}
        if (curSpawn >= maxSpawn)
        {
            return;
        }
        curSpawn++;
        int x = 100 + curSpawn * 50;
        int y = 250;

        for (int i = 0; i < 10; i++)
        {
            GameObject obj = TrashMan.spawn("EnemyBall");
            obj.transform.parent = GameObject.Find("Canvas").transform;
            float         speed         = Random.Range(3, 5);
            float         max           = Random.Range(8, 13);
            RectTransform rect          = obj.GetComponent <RectTransform>();
            float         startY        = y - i * 50;
            EnemyBallView enemyBallView = obj.GetComponent <EnemyBallView>();
            enemyBallView.speed   = speed;
            enemyBallView.max     = max;
            enemyBallView.startY  = startY;
            enemyBallView.start   = true;
            rect.anchoredPosition = new Vector2(x, startY);
        }
    }
Esempio n. 30
0
    void GetElectrocutador(Block block, Pattern pattern, Transform pos)
    {
        GameObject godefault = TrashMan.spawn(this.nameChildPattern, pos.position);

        godefault.GetComponent <BlockElement>().Initialize(block);

        godefault.transform.rotation = pattern.transform.rotation;
    }