예제 #1
0
    IEnumerator ReplaceBall()
    {
        yield return(new WaitForSeconds(5));

        /* while (this.transform.parent != null)
         * {
         *   yield return new WaitForSeconds(5);
         * }*/
        this.GetComponent <MeshRenderer>().enabled = false;
        yield return(new WaitForSeconds(.5f));



        this.GetComponent <Rigidbody>().velocity        = Vector3.zero;
        this.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
        GameObject sPlanet = this.GetComponent <BallGrab>().getStartingPlanet();
        GameObject ePlanet = this.GetComponent <BallGrab>().getTransitionedPlanet();

        Gravity2.TransitionPlanetGravity(ePlanet, sPlanet, this.gameObject);
        print("resetting gravity");

        this.gameObject.transform.position         = startPos;
        this.GetComponent <MeshRenderer>().enabled = true;
        // ScoringMechanic.S.IncrementScore();
    }
예제 #2
0
 // Start is called before the first frame update
 void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.tag == "Ball")  //transitions gravitational attraction to this planet if ball crosses trigger
     {
         //print("transition hit");
         Gravity2.TransitionPlanetGravity(coll.gameObject.GetComponent <BallGrab>().getStartingPlanet(), planet.gameObject, coll.gameObject);
     }
 }
예제 #3
0
    public void InstantRespawn()
    {
        this.GetComponent <MeshRenderer>().enabled      = false;
        this.GetComponent <Rigidbody>().velocity        = Vector3.zero;
        this.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
        GameObject sPlanet = this.GetComponent <BallGrab>().getStartingPlanet();
        GameObject ePlanet = this.GetComponent <BallGrab>().getTransitionedPlanet();

        Gravity2.TransitionPlanetGravity(ePlanet, sPlanet, this.gameObject);
        print("resetting gravity");

        this.gameObject.transform.position         = startPos;
        this.GetComponent <MeshRenderer>().enabled = true;
    }