Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

Error CS0177 - "GameManager does not contain a definition for 'GetPlayer' PLEASE HELP!

$
0
0
I have been presented with this in my PlayerShoot Code. Error CS0117: 'GameManager' does not contain a definition for 'GetPlayer' (CS0117) (Assembly-CSharp), Here is my code, thanks for looking :) using UnityEngine.Networking; using UnityEngine; public class PlayerShoot : NetworkBehaviour { private const string PLAYER_TAG = "Player"; public PlayerWeapon weapon; [SerializeField] private Camera cam; [SerializeField] private LayerMask mask; void Start () { if (cam == null) { Debug.LogError ("PlayerShoot: No camera referenced!"); this.enabled = false; } } void Update () { if (Input.GetButtonDown ("Fire1")) { Shoot (); } } [Client] void Shoot () { RaycastHit _hit; if (Physics.Raycast(cam.transform.position, cam.transform.forward, out _hit, weapon.range, mask)) { if (_hit.collider.tag == PLAYER_TAG) { CmdPlayerShot (_hit.collider.name, weapon.damage); } Debug.Log ("Player " + GetComponent ().netId + " hit " + _hit.collider.name); } } [Command] void CmdPlayerShot (string _playerID, int _damage) { Debug.Log (_playerID + " has been shot."); Player _player = GameManager.GetPlayer (_playerID); _player.TakeDamage (_damage); } }

Viewing all articles
Browse latest Browse all 215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>