Example #1
0
 void Update()
 {
     if (nextBoom < Time.fixedTime)
     {
         Vector3    explosionPos = transform.position;
         Collider[] colliders    = Physics.OverlapSphere(explosionPos, radius);
         foreach (Collider hit in colliders)
         {
             Rigidbody rb    = hit.GetComponent <Rigidbody>();
             Mover     mover = hit.GetComponent <Mover>();
             if (rb != null)
             {
                 if (mover != null)
                 {
                     mover.AddVelocity(power, explosionPos, radius, 3.0F);
                 }
                 else
                 {
                     rb.AddExplosionForce(power, explosionPos, radius, 3.0F);
                 }
             }
         }
         nextBoom = Time.fixedTime + timing;
     }
 }
Example #2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F))
        {
            mover.AddVelocity(dashingForce, transform.position - Camera.main.transform.forward, 4f, 15f, true, false);
            if (speedParticles != null)
            {
                speedParticles.EmitInstantly(25);
            }
        }

        HandleJumpKeyInput();
    }