private void HangUpdate() { if (player.viableHangs.Count != 0) { float min = Mathf.Infinity; HangObject best = null; foreach (HangObject x in player.viableHangs) { if (x.Validate()) { float tmp = (player.transform.position - x.hangPoint.transform.position).magnitude; if (tmp < min) { min = tmp; best = x; } } } if (best != null) { player.actualHang = best; player.actualPhase.SendRequestToCreateState(PlayerStates.Hang); } } }
private HangObject CreateHang(Transform player) { switch (typeOfHang) { case HangTypes.Ledge: return(actHang = new Ledge(gameObject, player.gameObject)); default: return(actHang = new Ledge(gameObject, player.gameObject)); } }