コード例 #1
0
ファイル: OrbitBody.cs プロジェクト: jono-m/GameJams
 private void Awake()
 {
     if (comet == null)
     {
         comet   = FindObjectOfType <CometController>();
         cometRB = comet.GetComponent <CircleCollider2D>();
     }
 }
コード例 #2
0
ファイル: EscapeRingRenderer.cs プロジェクト: jono-m/GameJams
    void OnWin()
    {
        c.currentState = CometController.State.FreeAtLast;
        c.GetComponent <Rigidbody2D>().velocity = (c.cometCam.transform.position.normalized - c.massiveBody.transform.position).normalized * c.launchVelocity;

        if (!hasWon)
        {
            OnWinEvent.Invoke();
            hasWon = true;
        }
    }
コード例 #3
0
ファイル: SunCheck.cs プロジェクト: jono-m/GameJams
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponent <CometController>() != null)
        {
            CometController c = collision.GetComponent <CometController>();
            c.speedProgress = 0;
            c.currentState  = CometController.State.Idle;

            float   startPosHeight = Vector2.Distance(c.startPos.position, transform.position);
            Vector2 newAngle       = (c.transform.position - transform.position).normalized;
            c.startPos.position = newAngle * startPosHeight;
            c.startPos.up       = newAngle.normalized;
            c.GetComponent <Rigidbody2D>().velocity = Vector2.zero;

            logic.currentState = UILogic.State.IdleOnSun;
        }
    }