Hi guys im not sure what this error means.
Assets/Scripts/Player/Character.cs(37,17): error CS0029: Cannot implicitly convert type NetworkManager.Player' to
Player’
Heres my script
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Character : MonoBehaviour {
public Transform FirstPerson;
public WeaponManager FirstpersonCont;
public Transform ThirdPerson;
public NetworkManager.Player MyPlayer;
public Vector3 CurPos;
public Quaternion CurRot;
public GameObject RagDoll;
public List<ThirdPersonGuns> Guns = new List<ThirdPersonGuns>();
public Player LastShootBy;
public string LastShootByName;
// Use this for initialization
void Start () {
MyPlayer.Manager = this;
MyPlayer = NetworkManager.GetPlayer (networkView.owner);
FirstPerson.gameObject.SetActive (false);
ThirdPerson.gameObject.SetActive (false);
DontDestroyOnLoad (gameObject);
}
// Update is called once per frame
void Update () {
}
[RPC]
public void FindHitter(string name)
{
LastShootBy = NetworkManager.GetPlayer(name);
LastShootByName = name;
}
[RPC]
public void GetKill()
{
RankManager.Inst.Exp += 100;
}
[RPC]
void Server_TakeDamage (float Damage)
{
networkView.RPC ("Client_TakeDamage", RPCMode.Server, Damage);
}
[RPC]
void Client_TakeDamage (float Damage)
{
MyPlayer.Health -= Damage;
Debug.Log (MyPlayer.Health);
if (MyPlayer.Health <= 0)
{
//networkView.RPC("Die",RPCMode.All);
Die ();
MyPlayer.IsAlive = false;
MyPlayer.Health = 0;
Instantiate(RagDoll,ThirdPerson.position,ThirdPerson.rotation);
}
}
[RPC]
void Spawn()
{
MyPlayer.Health = 100;
MyPlayer.IsAlive = true;
if (networkView.isMine)
{
FirstPerson.gameObject.SetActive (true);
ThirdPerson.gameObject.SetActive (false);
}
else
{
FirstPerson.gameObject.SetActive (false);
ThirdPerson.gameObject.SetActive (true);
}
}
[RPC]
void Die()
{
MyPlayer.IsAlive = false;
MyPlayer.Deaths++;
FirstPerson.gameObject.SetActive (false);
ThirdPerson.gameObject.SetActive (false);
MyPlayer.Manager.LastShootBy.networkView.RPC("GetKill",LastShootBy.MyPlayer.OnlinePlayer);
}
void OnSerializeNetworkView(BitStream stream,NetworkMessageInfo info)
{
if (stream.isWriting)
{
CurPos = FirstPerson.position;
CurRot = FirstPerson.rotation;
stream.Serialize(ref CurPos);
stream.Serialize(ref CurRot);
char Ani = (char)GetComponent<NetworkAnimsStates>().CurrentAnim;
stream.Serialize (ref Ani);
}
else
{
stream.Serialize(ref CurPos);
stream.Serialize(ref CurRot);
ThirdPerson.position = CurPos;
ThirdPerson.rotation = CurRot;
char Ani = (char)0;
stream.Serialize(ref Ani);
GetComponent<NetworkAnimsStates>().CurrentAnim = (NetworkAnimsStates.Animations)Ani;
}
}
public void Server_GetGun(string name)
{
networkView.RPC ("Client_GetGun", RPCMode.All, name);
Debug.Log (name);
}
[RPC]
public void Client_GetGun(string name)
{
foreach (ThirdPersonGuns tpg in Guns)
{
if(tpg.Name == name)
{
tpg.Obj.SetActive(true);
Debug.Log (tpg + "Done");
}
else
{
tpg.Obj.SetActive (false);
Debug.Log (tpg + "Not Done");
}
}
}
[System.Serializable]
public class ThirdPersonGuns
{
public string Name;
public GameObject Obj;
}
}