Example #1
0
 // Use this for initialization
 void Start()
 {
     Platforms = GameObject.Find("Platforms");
     gameObject.transform.parent = Platforms.transform;
     ballStateObj = GameObject.Find("BallState");
     ballState    = ballStateObj.GetComponent <BallCollisions> ();
 }
Example #2
0
    void Start()
    {
        rb2D         = GetComponent <Rigidbody2D>();
        ballState    = ballStateObj.GetComponent <BallCollisions>();
        ballStateObj = GameObject.Find("BallState");

        rb2D.AddForce(new Vector2(fireSpeed, 0));
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        player          = GetComponent <Player2>();
        BallSourceObj   = GameObject.Find("BallSource");
        ballForceScript = BallSourceObj.GetComponent <BallForce>();

        ballStateObj = GameObject.Find("BallState");
        ballState    = ballStateObj.GetComponent <BallCollisions>();

        PrefabManager       = GameObject.Find("PrefabManager");
        prefabManagerScript = PrefabManager.GetComponent <PrefabManager>();

        ballPrefab = prefabManagerScript.Prefabs [0];
    }
Example #4
0
    PlayerController controller;     //Links the PlayerController script

    // Use this for initialization
    void Start()
    {
        audio   = GetComponent <AudioSource>();
        hasBall = false;

        fireBallScript = GetComponent <FireBall3>();

        World  = GameObject.Find("World");
        worldS = World.GetComponent <WorldSettings>();

        ballState    = ballStateObj.GetComponent <BallCollisions>();
        controller   = GetComponent <PlayerController> ();      //Links the PlayerController script
        ballStateObj = GameObject.Find("BallState");

        gravity      = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); //calculates the gravity of
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;              //Calculates how quickly the player jumps
        print("Gravity: " + gravity + "Jump Velocity: " + jumpVelocity); //Prints the details of the calculations
    }