示例#1
0
    private void Update()
    {
        //rotationInterpolation();
        TimeManager.TimeScale = 0.2f + (currentSpeed / maxDashSpeed);
        sr.color = Color.Lerp(normalColor, superSonicColor, currentSpeed / maxDashSpeed);

        keys[((int)'W')] = Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow);
        keys[((int)'S')] = Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow);
        keys[((int)'A')] = Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow);
        keys[((int)'D')] = Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow);
        if ((!superSonic) && keys['W'])
        {
            PlaySounds ps = GameObject.FindObjectOfType <PlaySounds>();
            ps.ads.PlayOneShot(ps.sounds[1]);
            GameObject bullet       = playerBulletPool.getInactivePooledObject();
            Bullet     playerBullet = bullet.GetComponent <Bullet>();
            playerBullet.init(new Vector2(transform.position.x, transform.position.y), Mathf.Atan2(transform.up.y, transform.up.x) * (180 / Mathf.PI), 12.0f);
            bullet.SetActive(true);
        }

        if (keys['A'])
        {
            transform.eulerAngles += new Vector3(0, 0, (rotationSpeed / (currentSpeed + 0.2f)) * Time.deltaTime * TimeManager.TimeScale);
        }

        if (keys['D'])
        {
            transform.eulerAngles += new Vector3(0, 0, (-rotationSpeed / (currentSpeed + 0.2f)) * Time.deltaTime * TimeManager.TimeScale);
        }

        if ((Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) && !superSonic)
        {
            goSupersonic();
        }

        currentSpeed = dashRate.Evaluate(dashTime.Value / dashMaxTime) * maxDashSpeed;

        if (superSonic && currentSpeed <= dashRate.keys[1].value)
        {
            stopSupersonic();
        }

        if (dashTime.tick(Time.deltaTime))
        {
            dashTime.maxOut();
            dashTime.paused = true;
        }

        if (Input.GetKey(KeyCode.LeftShift))
        {
            rotationSpeed = lowRotationSpeed;
        }
        else
        {
            rotationSpeed = highRotationSpeed;
        }

        transform.position += transform.up * currentSpeed * Time.deltaTime * TimeManager.TimeScale;
    }
 void Update()
 {
     if (c.tick(Time.deltaTime))
     {
         Bullet b = pool.getInactivePooledObject().GetComponent <Bullet>();
         b.init(transform.position, ((Mathf.Atan2(transform.right.y, transform.right.x) * 180 / Mathf.PI) + Random.Range(-thetaRange, thetaRange)), 10);
         b.gameObject.SetActive(true);
     }
 }
示例#3
0
 void Update()
 {
     if (c.tick(Time.deltaTime))
     {
         Bullet b = pool.getInactivePooledObject().GetComponent <Bullet>();
         b.init(transform.position, Random.Range(0, 360));
         b.gameObject.SetActive(true);
     }
 }
示例#4
0
 void Update()
 {
     if (clock.tick(Time.deltaTime))
     {
         SpinAndDecay particle = particlePool.getInactivePooledObject().GetComponent <SpinAndDecay>();
         particle.init((Vector2)transform.position + (Random.insideUnitCircle * 0.1f), color);
         particle.gameObject.SetActive(true);
     }
 }
 public void die()
 {
     if (parent)
     {
         ProgressManager.Instance.increment();
         for (int i = 0; i < 20; i++)
         {
             Bullet b = pool.getInactivePooledObject().GetComponent <Bullet>();
             b.init(transform.position, Random.Range(0, 360), Random.Range(4f, 6f));
             b.gameObject.SetActive(true);
         }
         PlaySounds ps = GameObject.FindObjectOfType <PlaySounds>();
         ps.ads.PlayOneShot(ps.sounds[0]);
     }
     else
     {
         for (int i = 0; i < 10; i++)
         {
             Bullet b = pool.getInactivePooledObject().GetComponent <Bullet>();
             b.init(transform.position, Random.Range(0, 360), Random.Range(4f, 6f));
             b.gameObject.SetActive(true);
         }
     }
 }