コード例 #1
0
    /// <summary>
    /// Runs one time at game creation.
    /// </summary>
    public void Awake()
    {
        if (controller == null)
        {
            controller = this;
            DontDestroyOnLoad(controller);
        }
        else if (this != controller)
        {
            Destroy(this);
        }

        if (canvasGameOver != null)
        {
            canvasGameOver.gameObject.SetActive(false);
        }

        // Reset ga,e variables
        score.value             = 0;
        carsHit.value           = 0;
        hotDogsShot.value       = 0;
        hotDogsHit_Car.value    = 0;
        hotDogsHit_Person.value = 0;
        damages.value           = 0.0f;
    }
コード例 #2
0
    /// <summary>
    /// Runs one time at game creation.
    /// </summary>
    public void Awake()
    {
        if (controller == null)
        {
            controller = this;
            DontDestroyOnLoad(controller);
        }
        else if (this != controller)
        {
            Destroy(this);
        }

        if (canvasGameOver != null)
        {
            canvasGameOver.gameObject.SetActive(false);
        }
    }