Exemple #1
0
    void Update()
    {
        if (PlayerID == "")
        {
            if (!photonView.isMine)
            {
                playerIDCounter++;
                PlayerID = "Enemy" + playerIDCounter.ToString();
            }
            else
            {
                PlayerID = "Player";
            }
        }

        if (!photonView.isMine)
        {
            if (connected)
            {
                transform.position = Vector3.Lerp(transform.position, this.correctPlayerPos, Time.deltaTime * 5);
                transform.rotation = Quaternion.Lerp(transform.rotation, this.correctPlayerRot, Time.deltaTime * 5);

                if (HealthLevel >= 0)
                {
                    GetComponent <Health>().SetHealthLevel(HealthLevel);
                    if (!GetComponent <Health>().IsAlive)
                    {
                        FindObjectOfType <AnimationGenerator>().PlaceExplosion(transform.position);
                        Destroy(transform.parent.gameObject);
                    }
                }
            }
        }
        else
        {
            PlayerScore = (int)GetComponent <PlayerScore>().RoundedScore;
            PlayerName  = GameInformation.GetPlayerName();
            HealthLevel = GetComponent <Health>().HealthLevel;
        }
    }
 void Start()
 {
     GetComponent <UnityEngine.UI.Text>().text =
         GameInformation.GetPlayerName();
 }