예제 #1
0
    private void FixedUpdate()
    {
        if (applyForce)
        {
            Debug.Log("Force Applied");
            Vector3 directionHit = hitObject.gameObject.transform.position - transform.position;
            hitObject.AddForce(directionHit * HitStrength);
            applyForce = false;

            //make it expell all the passengers
            if (hitObject.gameObject.tag == "UFO")
            {
                UFO ufoObject = hitObject.gameObject.GetComponent <UFO>();
                ufoObject.EjectPassengers();
            }
        }
    }