// Start is called before the first frame update void Start() { mainCamera = GameObject.FindGameObjectWithTag("CameraRoot"); //Get the player and batteries playerPawn = GameObject.FindGameObjectWithTag("Player"); battery1Pawn = GameObject.FindGameObjectWithTag("Battery1"); battery2Pawn = GameObject.FindGameObjectWithTag("Battery2"); //Get scripts playerPawnScript = playerPawn.GetComponent <MoveablePawnScript>(); battery1PawnScript = battery1Pawn.GetComponent <MoveablePawnScript>(); battery2PawnScript = battery2Pawn.GetComponent <MoveablePawnScript>(); //Setup the camera and rigid bodies mainCamera.GetComponent <CameraController>().UpdateCamera(playerPawn); playerRB = playerPawn.GetComponent <Rigidbody>(); Battery1RB = battery1Pawn.GetComponent <Rigidbody>(); Battery2RB = battery2Pawn.GetComponent <Rigidbody>(); playerCanMove = true; }
// Start is called before the first frame update void Start() { energyScript = energyObject.GetComponent <MoveablePawnScript>(); slider = GetComponent <Slider>(); slider.value = energyScript.GetEenergyAmount(); }