private void OnPlayerName(string name) { this.playerName = name; if (hudControl != null) { hudControl.CreateHudName(this.playerName); } }
void Start() { if (hudControl == null) { hudControl = new HudControl(); hudControl.Init(thisTransform); hudControl.CreateHudName(playerName); hudControl.CreateHudScore(this.score); } if (isLocalPlayer) { sight.enabled = true; sight.range = sightRange; sight.spotAngle = sightAngle; quan.SetActive(true); ripArea.SetActive(false); EventMgr.instance.TriggerEvent("beginProcessInput"); EventMgr.instance.AddListener <Vector3>("joystickMove", OnMove); EventMgr.instance.AddListener("joystickStop", OnStop); EventMgr.instance.AddListener <bool>("catchPress", OnCatchPress); EventMgr.instance.AddListener <bool>("runPress", OnRunPress); EventMgr.instance.AddListener <GameObject>("OnSignPress", OnSignPress); EventMgr.instance.AddListener("boxPress", OnBoxPress); } else { sight.enabled = false; quan.SetActive(false); ripArea.SetActive(false); } leftRunEnergy = runEnergy; if (hasAuthority) { RipMgr.instance.AddTarget(gameObject, bodyRadius); } if (isClient) { sightController = gameObject.AddMissingComponent <SightController>(); } // 有可能是中途进入游戏 model.SetActive(!hideInfo.hide); if (!hideInfo.hide && sightController.InSight) { if (hudControl != null) { hudControl.Show(); } else if (hudControl != null) { hudControl.Hide(); } } }