// Start is called before the first frame update
    void Start()
    {
        //controll the player start point
        the_player = FindObjectOfType <player_controller>();

        if (the_player.start_point == point_name)
        {
            the_player.transform.position = transform.position;
            the_player.last_move          = startDirection;


            //controll the camera start point
            the_Camera = FindObjectOfType <Camera_controller>();
            the_Camera.transform.position = new Vector3(transform.position.x, transform.position.y, the_Camera.transform.position.z);
        }
    }
示例#2
0
    void Start()
    {
        GameObject ball = GameObject.Instantiate(ball_prefab);

        ball.name = "sphere";
        ball.transform.position = transform.position + Vector3.up * 2f;

        Camera            camera           = Camera.Instantiate(camera_prefab);
        Camera_controller cameraController = camera.GetComponent <Camera_controller>();

        cameraController.sphere = ball.transform;

        Light light = Light.Instantiate(light_prefab);

        light.color     = Color.white;
        light.intensity = 0.5f;
        //RenderSettings.ambientMode = UnityEngine.Rendering.AmbientMode.Flat;
        RenderSettings.ambientLight = Color.white * 0.7f;

        if (PlayerPrefs.GetInt("ball", 0) == 0)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_0;
        }
        if (PlayerPrefs.GetInt("ball", 0) == 1)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_1;
        }
        if (PlayerPrefs.GetInt("ball", 0) == 2)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_2;
        }
        if (PlayerPrefs.GetInt("ball", 0) == 3)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_3;
        }
        if (PlayerPrefs.GetInt("ball", 0) == 4)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_4;
        }
        if (PlayerPrefs.GetInt("ball", 0) == 5)
        {
            ball.GetComponent <Renderer>().sharedMaterial.mainTexture = texture_5;
        }
    }
示例#3
0
 private void Awake()
 {
     instance = this;
 }