void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Platform" && platformObject.gameObject == collision.gameObject) { platformObject = null; } }
void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.tag == "Platform") { platformObject = collision.GetComponent <TravellingObject>(); } }
// Start is called before the first frame update void Start() { travelDistance = LevelData.LevelInstance.GetComponent <Grid>().cellSize.x * LevelData.LevelInstance.transform.localScale.x; platformObject = null; currentLane = null; parentController = PlayerController.playerInstance.GetComponent <PlayerController>(); maxHeight = transform.position.y; }
void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.tag == "Enemy") { Die(); } if (collision.gameObject.tag == "Platform") { platformObject = collision.GetComponent <TravellingObject>(); } if (collision.gameObject.tag == "Lane") { currentLane = collision.GetComponent <LaneData>(); } if (collision.gameObject.tag == "Objective") { ObjectiveCompleted(); } }