void Start()
    {
        tm  = GetComponentInChildren <TextMesh>();
        gms = GameManagerScript.instance;
        pf  = GetComponent <PathFollower>();
        if (isPlayer)
        {
            isPlayer = true;
            GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraFollowScript>().SetCamera(this.transform);

            UIManagerScript.instance.mainPlayerStats = this.GetComponent <Statistics>();
            ps = GetComponent <PlayerScript>();
            GetComponent <AIScript>().enabled = false;
        }
        else
        {
            isPlayer = false;
            ais      = GetComponent <AIScript>();
            GetComponent <PlayerScript>().enabled = false;
        }
        //  gms.stats.Add(this.GetComponent<Statistics>());
        gms.AddToStats(GetComponent <Statistics>());
        tm.text       = playerName;
        thisTransform = GetComponent <Transform>();
        startZ        = thisTransform.position.z;
        goalZ         = GameObject.FindGameObjectWithTag("Goal").GetComponent <Transform>().position.z;
        divZ          = goalZ - startZ;
    }
Beispiel #2
0
    void Start()
    {
        tm  = GetComponentInChildren <TextMesh>();
        gms = GameManagerScript.instance;
        pf  = GetComponent <PathFollower>();
        ts  = GameObject.FindGameObjectWithTag("Train").GetComponent <TrainScript>();

        if (GetComponent <BehaviourScript>().isPlayer)
        {
            isPlayer = true;
        }
        else
        {
            isPlayer = false;
        }
        gms.AddToStats(GetComponent <Statistics>());
        tm.text = playerName;
    }