public CheckPoint(float x, float y) { this.x = x; this.y = y; this.inTracks = new ArrayList(); this.outTracks = new ArrayList(); this.status = CheckPointStatus.Go; }
IEnumerator SetHeroPosition() { if (Hero == null) { yield break; } Hero.transform.SetParent(InGameVars.level.transform); Hero.transform.position = CheckPointStatus.GetCheckPoint().Position; //Hero.transform.position = new Vector2(2768, -40); RaycastHit2D groundPointHit = Physics2D.Raycast(Hero.transform.position, Vector2.down, 256f, 1 << LayerMask.NameToLayer("Ground")); if (groundPointHit.collider) { var groundPoint = groundPointHit.point; Hero.transform.position = Vector2.up + new Vector2(groundPoint.x, groundPoint.y - (Hero.GetComponent <SpriteRenderer>().size.y - Hero.GetComponent <SpriteRenderer>().size.y - Hero.GetComponent <SpriteRenderer>().sprite.pivot.y)); } if (groundPointHit.collider != null) { Debug.DrawLine(Hero.transform.position, groundPointHit.point, Color.red, 100.1f, false); } yield return(new WaitForFixedUpdate()); }
private void OnHeroEnter() { CheckPointStatus.SetCheckPoint(transform.position); Destroy(this.gameObject); }
public void Confirm() { Status = CheckPointStatus.Permanent; }