コード例 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        switch (tag)
        {
        case "PowerUp":
            PowerUpQirn puq = collision.gameObject.GetComponent <PowerUpQirn>();
            puq.PowerUp();
            break;

        case "FractalQirn":

            FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>();

            if (fractal)
            {
                if (CenterQirn.Instance)
                {
                    CenterQirn.Instance.AddScore(fractal.Worth);
                }
                fractal.PlaySound();
                fractal.Pool();
            }

            break;
        }
    }
コード例 #2
0
    public static void PoolFractalQirn(FractalQirn f)
    {
        f.transform.position = new Vector3(1 * PoolSize, -25f, f.transform.position.z);

        f.transform.parent = PooledFractalHolder;

        f.enabled = false;

        pooledFractals.Add(f.gameObject);
    }
コード例 #3
0
ファイル: CenterQirn.cs プロジェクト: DustinBrown917/Qyrnz
    /// <summary>
    /// Trigger enter event.
    /// </summary>
    /// <param name="collision"></param>
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        switch (tag)
        {
        case "PowerUp":
            PowerUpQirn puq = collision.gameObject.GetComponent <PowerUpQirn>();
            puq.Pool();
            break;

        case "FractalQirn":

            FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>();
            if (fractal)
            {
                OnFractalQirnCollided();
                AddScore(-(int)(_score * pointDecayFactor));

                audioSource.clip = clips[UnityEngine.Random.Range(0, clips.Length)];
                audioSource.Play();

                if (GameManager.GameMode == GameModes.LIMITED || GameManager.GameMode == GameModes.WARP)
                {
                    if (_revivesRemaining > 0)
                    {
                        if (canLoseRevives)
                        {
                            _revivesRemaining -= 1;
                            canLoseRevives     = false;
                            StartCoroutine(ReviveTimer());
                        }

                        PopUpManager.Instance.PopUp("PU_Revive");
                    }
                    else
                    {
                        GameManager.Instance.ChangeGameState(GameStates.POST_PLAY);
                    }
                }

                fractal.Pool();
            }

            break;
        }
    }
コード例 #4
0
    public static void DeployPowerUp(PowerUps powerUp)
    {
        switch (powerUp)
        {
        case PowerUps.SPEED_UP:
            ForceSpeedUpStop();
            cr_speedUp = Instance.StartCoroutine(SpeedUp());
            break;

        case PowerUps.NUKE:
            FractalQirn.DestroyAll(true);
            break;

        case PowerUps.SHIELD:
            CenterQirn.Instance.SetShieldActive(true);
            break;
        }
    }
コード例 #5
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        string tag = collision.gameObject.tag;

        switch (tag)
        {
        case "FractalQirn":

            FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>();
            if (fractal)
            {
                fractal.Pool();
                PivotMaskTowardTarget(collision.transform);
                BeginDisable();
            }

            break;
        }
    }
コード例 #6
0
    private static GameObject PullFractalQirn()
    {
        if (pooledFractals.Count >= 1)
        {
            FractalQirn f = pooledFractals[PoolSize - 1].GetComponent <FractalQirn>();

            pooledFractals.RemoveAt(PoolSize - 1);

            if (f.enabled)
            {
                return(PullFractalQirn());
            }
            else
            {
                f.GetComponent <FractalQirn>().enabled = true;
            }

            return(f.gameObject);
        }
        else
        {
            return(null);
        }
    }