Class Player2D
Very simple implementation of a player that can interact with objects.
Inheritance
System.Object
Player2D
Namespace: Edgar.Unity.Examples
Assembly: cs.temp.dll.dll
Syntax
public class Player2D : MonoBehaviour
Methods
OnTriggerEnter2D(Collider2D)
If the collision is with an interactable object that is allowed to interact, make this object the current focus of the player.
Declaration
public void OnTriggerEnter2D(Collider2D collider)
Parameters
Type | Name | Description |
---|---|---|
Collider2D | collider |
OnTriggerExit2D(Collider2D)
If the collision is with the interactable object that is currently the focus of the player, make the focus null.
Declaration
public void OnTriggerExit2D(Collider2D collider)
Parameters
Type | Name | Description |
---|---|---|
Collider2D | collider |
Update()
If an interactable object is in focus and is allowed to interact, call its Interact() method.
Declaration
public void Update()