Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (go)
        {
            velocity = speed; //TODO: smooth ramp up/ ramp down

            if (Input.GetAxis("Boost") > 0)
            {
                gunController.AddEnergy(-1 * boostDrain * Time.deltaTime);
                velocity *= boostMult;
                boostAnimator.SetBool("isBoosting", true);
                if (engineImpulse != null)
                {
                    engineImpulse.GenerateImpulse();
                }
            }
            else
            {
                boostAnimator.SetBool("isBoosting", false);
            }

            this.transform.position += Time.deltaTime * velocity * this.transform.forward;
        }

        this.transform.LookAt(targetObject.transform);
    }
Пример #2
0
        private void OnTriggerEnter(Collider other)
        {
            var damage = other.GetComponentInChildren <DealsDamage>();

            if (damage != null)
            {
                gun.AddEnergy(energyAdd);
                particles.Emit(1);
                audioSource.Play();
            }
        }