Browse Source

Incorrect babies are now yeeted back to player who threw them

develop
MrJDunn 3 years ago
parent
commit
258a5adffa
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      Assets/ParentBehaviour.cs

+ 5
- 1
Assets/ParentBehaviour.cs View File

@ -178,7 +178,11 @@ public class ParentBehaviour : MonoBehaviour
parentDialougeObj.GetComponent<Image>().sprite = Sprite.Create((Texture2D)_displayGraphic, new Rect(0.0f, 0.0f, _displayGraphic.width, _displayGraphic.height), new Vector2(0.5f, 0.5f), 100.0f);
//yeet child back to centre of room
//child = collision.collider.gameObject
Debug.Log("ParentBehaviour.OnCollissionEnter: Yeet Back Child");
GameObject lastHeldPlayer = collision.collider.gameObject.GetComponent<YeetHandle>().lastHeld;
float yeetBackForce = 15f;
Vector3 yeetBackVelocity = (-1 * lastHeldPlayer.transform.forward * yeetBackForce) + lastHeldPlayer.transform.up * yeetBackForce;
collision.collider.gameObject.GetComponent<Rigidbody>().velocity = yeetBackVelocity;
}
}
}

Loading…
Cancel
Save