Beispiel #1
0
    public void LoseLife(Vector3 collisionPos)
    {
        PoolObject po = _pool.ActivateObject("BlockHitParticles");

        if (po == null)
        {
            Debug.Log("No particles");
        }
        Vector3 pos = collisionPos;

        pos.z = -3;
        po.transform.position = pos;
        po.GetComponent <ParticleScript>().Fire();
        LoseLife();
    }
Beispiel #2
0
    void Update()
    {
        _currentReloadDelay -= Time.deltaTime;
        if (_loadedBullet == null && _currentReloadDelay <= 0.0f && _remainingLives > 0)
        {
            _loadedBullet = _pool.ActivateObject("Bullet");
            _loadedBullet.transform.position = BulletSocket.transform.position;
            _loadedBullet.transform.rotation = BulletSocket.transform.rotation;
            _anim.Play("Player_Reload");
        }

        bool fire = false;

        if (_remainingLives <= 0)
        {
            return; // player can't fire anymore
        }
#if UNITY_STANDALONE || UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.Space) && _loadedBullet != null)
        {
            fire = true;
        }
#elif UNITY_ANDROID // currently to test on phone
        if (Input.touchCount == 1 && Input.touches[0].phase == TouchPhase.Began)
        {
            fire = true;
        }
#endif
        if (fire)
        {
            StartCoroutine("Fire", FireDelay);
        }
    }
Beispiel #3
0
    IEnumerator SpawnBlocks()
    {
        yield return(new WaitForSeconds(1)); // hold the spawner for the countdown

        UnlockLine();
        while (true)                                                                             // sounds so bad
        {
            List <SpawnPointScript> _possibleLocations = SpawnPoints.FindAll(e => e.IsUnlocked); // Lambda again, a little bit heavier but its on separate thread

            float delay = _level.CurrentSpawnDelay;
            if (_possibleLocations.Count > 0)
            {
                int line = Random.Range(0, _possibleLocations.Count); // Range is exclusive the max value
                                                                      // TTT Fix this for the amount we have
                                                                      // get a random size

                if (!_spawnCredit)
                {
                    int size = Random.Range(2, 5);
                    delay *= size;
                    PoolObject block = _pool.ActivateObject("L1Block" + size);
                    block.GetComponent <Rigidbody2D>().transform.rotation = Quaternion.Euler(0, 0, 90);
                    block.GetComponent <BlockScript>().MovementSpeed      = 250.0f;

                    block.transform.position = _possibleLocations[line].transform.position;

                    _activeLevelBlocks.Add(block);
                }
                else
                {
                    int size = Random.Range(2, 5);
                    delay *= size;

                    PoolObject credit = _pool.ActivateObject("Credit");
                    credit.GetComponent <CreditScript>().MovementSpeed = 250.0f;

                    credit.transform.position = _possibleLocations[line].transform.position;

                    _activeLevelBlocks.Add(credit);

                    _spawnCredit = false;
                }
            }
            yield return(new WaitForSeconds(delay));
        }
    }
Beispiel #4
0
    public void PushVisual(int score, VisualType type)
    {
        PoolObject po = _pool.ActivateObject("ScoreVisual");

        po.transform.SetParent(VisualParent);
        po.transform.localScale    = new Vector3(0.25f, 0.25f, 0.25f);
        po.transform.localPosition = new Vector3(0, 0, 0);
        string text = "";

        switch (type)
        {
        case VisualType.SWEET:
            text = "Sweet";
            break;

        case VisualType.COOL:
            text = "Cool";
            break;

        case VisualType.AWESOME:
            text = "Awesome!";
            break;

        case VisualType.MAJESTIC:
            text = "Majestic";
            break;

        case VisualType.ONFIRE:
            text = "On fire";
            break;

        case VisualType.GODLIKE:
            text = "Godlike";
            break;

        case VisualType.CHEAT:
            text = "CHEAT!";
            break;

        case VisualType.SOCLOSE:
            text = "So close";
            break;

        case VisualType.SUPERCLOSE:
            text = "Superclose!";
            break;

        case VisualType.WTF:
            text = "What the...";
            break;
        }
        po.GetComponent <VisualScript>().VisualText.text = text + " +" + score;
        po.GetComponent <Animator>().Play("Score_Addition");

        _visualList.Add(new Visual(0.5f, po));
    }