// Use this for initialization void Start() { m_renderer = GetComponent <Renderer>(); m_transform = transform; bounding = false; movement = GetComponent <PendulumMovement>(); }
// Use this for initialization void Start() { m_renderer = GetComponent<Renderer>(); m_transform = transform; bounding = false; movement = GetComponent<PendulumMovement>(); }
private void instantiatePlayer() { Vector3 posInstantiatePlayer = m_camera.ScreenToWorldPoint(new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, 0)); m_player = Instantiate(m_playerPrefab); m_player.transform.position = new Vector3(posInstantiatePlayer.x, posInstantiatePlayer.y, 0); PendulumMovement pendulum = m_player.GetComponent <PendulumMovement>(); pendulum.GameManager = this; pendulum.m_velocityMagnitude = playerInitialVelocity; float posChangeTextureLeft = m_camera.ScreenToWorldPoint(new Vector3(Screen.width * (changeTexture + borderSize + separationBorder), 0, 0)).x; float posChangeTextureRight = m_camera.ScreenToWorldPoint(new Vector3(Screen.width * (1 - (changeTexture + borderSize + separationBorder)), 0, 0)).x; TextureChange texture = m_player.GetComponent <TextureChange>(); texture.xLeft = posChangeTextureLeft; texture.xRight = posChangeTextureRight; }