Beispiel #1
0
 void ChangeOwner(GameObject obj)
 {
     playerTransform = obj.transform;
     playerRigid     = obj.GetComponent <Rigidbody2D>();
     playerCanvas.transform.SetParent(playerTransform);
     playerCanvas.transform.localPosition = Vector3.zero;
     Destroy(playerCollisionHandler);
     playerCollisionHandler            = playerTransform.gameObject.AddComponent <PlayerCollisionHandler>();
     playerCollisionHandler.Controller = this;
 }
Beispiel #2
0
 void Initialize()
 {
     playerTransform = initialPlayerTransform;
     playerRigid     = initialPlayerRigid;
     if (playerCanvas != null)
     {
         playerCanvas.transform.SetParent(playerTransform);
         playerCanvas.transform.localPosition = Vector3.zero;
     }
     else
     {
         playerCanvas = Instantiate(playerCanvasPrefab, playerTransform).GetComponent <PlayerCanvas>();
     }
     if (playerCollisionHandler != null)
     {
         Destroy(playerCollisionHandler);
     }
     playerCollisionHandler            = playerTransform.gameObject.AddComponent <PlayerCollisionHandler>();
     playerCollisionHandler.Controller = this;
     ball                = playerTransform.gameObject.GetComponent <Ball>();
     currentPushForce    = 0.0f;
     model.isRotationSet = false;
 }