Exemple #1
0
 private void Update()
 {
     age += Time.deltaTime;
     shipThrusters.GenerateThrusterParticles();
     this.transform.up = rBody.velocity;
     if (age >= lifespan)
     {
         Destroy(this.gameObject);
     }
 }
    // Thrust in forwards
    public void Thrust()
    {
        if (!controllable)
        {
            return;
        }
        thrusters.GenerateThrusterParticles();
        float mfs = maxForwardSpeed;

        if (attachedWeapon != null)
        {
            mfs *= attachedWeapon.SpeedScale;
        }
        if (rBody.velocity.magnitude >= mfs)
        {
            //rBody.velocity = rBody.velocity.normalized * maxForwardSpeed;
        }
        else
        {
            rBody.AddForce(Forward2D * forwardThrust);
        }
    }