コード例 #1
0
ファイル: Program.cs プロジェクト: koanse/CrossroadsModel
 public CheckPoint(float x, float y)
 {
     this.x         = x;
     this.y         = y;
     this.inTracks  = new ArrayList();
     this.outTracks = new ArrayList();
     this.status    = CheckPointStatus.Go;
 }
コード例 #2
0
    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());
    }
コード例 #3
0
 private void OnHeroEnter()
 {
     CheckPointStatus.SetCheckPoint(transform.position);
     Destroy(this.gameObject);
 }
コード例 #4
0
 public void Confirm()
 {
     Status = CheckPointStatus.Permanent;
 }