public void SetInfo(int _team, string _name, int _kill, int _death, float _score, PlayerNetwork _pnet)//Players { SetActive(true); if (m_team != null) { m_team.text = "Team" + _team.ToString(); } if (m_name != null) { m_name.text = _name; } if (m_killAndDeath != null) { m_killAndDeath.text = _kill.ToString() + "/" + _death.ToString(); } if (m_score != null) { m_score.text = _score.ToString(); } //if (m_captainSpr != null) // m_captainSpr.enabled = _iscaptain; if (_pnet != null) { mPnet = _pnet; } }
public void ClearInfo() { SetActive(false); if (m_team != null) { m_team.text = ""; } if (m_name != null) { m_name.text = ""; } if (m_killAndDeath != null) { m_killAndDeath.text = ""; } if (m_score != null) { m_score.text = ""; } if (m_captainSpr != null) { m_captainSpr.enabled = false; } if (m_AgreeSpr != null) { m_AgreeSpr.gameObject.SetActive(false); } if (m_DisAgreeSpr != null) { m_DisAgreeSpr.gameObject.SetActive(false); } mPnet = null; }
public void Init(NetworkInstanceId playerAskingID) { if (_init) { return; } _init = true; PlayerNetwork[] playerNetworks = FindObjectsOfType <PlayerNetwork>(); for (int i = 0; i < playerNetworks.Length; i++) { if (playerNetworks[i].netId == playerAskingID) { playerObserver = playerNetworks[i].gameObject; break; } } _playerNetwork = playerObserver.GetComponent <PlayerNetwork>(); _playerLife = GetComponentInChildren <PlayerLife>(); _playerLife.SetPlayerNetwork(_playerNetwork); _playerMovement = GetComponent <PlayerMovement>(); _playerFire = GetComponent <PlayerFire>(); _playerFire.SetPlayerNetwork(_playerNetwork); _playerCamera = GetComponent <PlayerCamera>(); GameManager.GetInstance().localPlayerNetwork = _playerNetwork; if (isServer) { GameManager.GetInstance().PlayerJoin(this); GameManager.GetInstance().ShowLog(_playerNetwork.playerName + " joined the fight !"); } }
private PlayerNetwork _currentChosedPlayer = null; //当前被选中的玩家 private void UICheckItemPlayer(PlayerNetwork pnet) //这个方法传过来一个PlayerNetwork,通过拿到他的阵营,判断加入哪只队伍 { if (pnet != null) { _currentChosedPlayer = pnet; } }
// 执行动作 // 若为瞬间动作,返回true; // 若为持续动作,该函数会每帧被调用,直到返回true public override bool Logic() { if (Pathea.PeGameMgr.IsMulti) { byte[] data = PETools.Serialize.Export(w => { BufferHelper.Serialize(w, obj); }); PlayerNetwork.RequestServer(EPacketType.PT_Custom_CancelOrder, data); } else { Pathea.PeEntity entity = PeScenarioUtility.GetEntity(obj); if (entity != null && entity.requestCmpt != null) { if (entity.requestCmpt.Contains(Pathea.EReqType.Dialogue)) { entity.requestCmpt.RemoveRequest(Pathea.EReqType.Dialogue); } if (entity.requestCmpt.Contains(Pathea.EReqType.MoveToPoint)) { entity.requestCmpt.RemoveRequest(Pathea.EReqType.MoveToPoint); } if (entity.requestCmpt.Contains(Pathea.EReqType.FollowTarget)) { entity.requestCmpt.RemoveRequest(Pathea.EReqType.FollowTarget); } } } return(true); }
public void Setup() { playerNetwork = player.GetComponent<PlayerNetwork>(); playerNetwork.playerName = playerName; playerNetwork.playerID = playerID; playerNetwork.characterIndex = characterIndex; }
private void Start() { horizontalEnable = true; rb = GetComponent <Rigidbody2D>(); player_sprite = GetComponent <SpriteRenderer>(); anim_manager = GetComponent <AnimManager>(); //This is for network use only, it's not for this project player_network = GetComponent <PlayerNetwork>(); p_collider = GetComponent <Collider2D>(); cam = UnityEngine.Camera.main.GetComponent <CameraFollow>(); CharacterController2D[] players = FindObjectsOfType <CharacterController2D>(); foreach (var player in players) { if (player != this) { other_player = player; } } blood_splatter.SetActive(false); }
private void Awake() { Instance = this; photonView = GetComponent <PhotonView>(); SceneManager.sceneLoaded += OnSceneFinishedLoading; }
public static void DelJoinRequest(PlayerNetwork player) { if (joinReqeust.Contains(player)) { joinReqeust.Remove(player); } }
public static void RegisterPlayer(string netID, PlayerNetwork playerNetwork) { string playerID = PLAYERIDPREFIX + netID; players.Add(playerID, playerNetwork); playerNetwork.transform.name = playerID; }
public void SetToTravelPos() { if (travelPos == Vector3.zero) { return; } PlayerNetwork pn = PlayerNetwork.mainPlayer; pn.transform.position = travelPos; if (null != pn._move) { pn._move.NetMoveTo(travelPos, Vector3.zero, true); } if (bTraveling) { return; } bTraveling = true; PeEntity mainPlayer = PeCreature.Instance.mainPlayer; if (null == mainPlayer) { Debug.LogError("no main player"); return; } PeTrans tran = mainPlayer.peTrans; if (null == tran) { return; } tran.position = travelPos; StartLoadScene(); }
private void Awake() { Instance = this; PhotonView = GetComponent <PhotonView>(); PlayerName = "Player#" + Random.Range(1000, 9999); SceneManager.sceneLoaded += OnSceneFinishedLoading; }
private void Start() { anim = GetComponent <Animator>(); Button examineBtn = GameObject.Find("Examine").GetComponent <Button>(); examineBtn.onClick.AddListener(Examine); knockBtn = GameObject.Find("Knock").GetComponent <Button>(); knockBtn.onClick.AddListener(Knock); Button washHandsBtn = GameObject.Find("WashHand").GetComponent <Button>(); washHandsBtn.onClick.AddListener(WashHands); Button stepInOut = GameObject.Find("StepInsideOutside").GetComponent <Button>(); stepInOut.onClick.AddListener(StepInOut); docNetworkUtility = GetComponent <DoctorNetworkUtility>(); playerNetworkUtility = GetComponent <PlayerNetwork>(); bothArmsBtn = GameObject.Find("RaiseBothArms"); GameObject.Find("RaiseBothArms").GetComponent <Button>().onClick.AddListener(RaiseBoth); notificationlabel = GameObject.Find("NotificationLabel"); notificationlabel.SetActive(false); patientDetector = GameObject.Find("PatientDetector").transform; examineGuide = GameObject.Find("examineGuide"); teleportGuide = GameObject.Find("teleportGuide"); sinkLocation = GameObject.Find("SinkWater"); }
//根据索引找到对应ItemInfo成员 /*T ListItemInfoFind<T> (List<T> Fromlist,T Member) * { * foreach (T info in Fromlist) * { * if(info==Member) * return info; * } * return null; * }*/ //列表更新 void Reflsh(List <UserAdmin> refashList) { Clear(); refashList.Sort((x, y) => { if (PlayerNetwork.IsOnline(x.Id) && PlayerNetwork.IsOnline(y.Id)) { return(0); } else if (PlayerNetwork.IsOnline(x.Id)) { return(-1); } else { return(1); } }); foreach (UserAdmin Admininfo in refashList) { AddAdminstItem(Admininfo); } mGird.repositionNow = true; }
void LateInitialize() { defaultCameraPos = transform.Find("Main Camera").localPosition; targetCameraPos = defaultCameraPos; currentTextureSpeedModifier = 1.0f; childKart = transform.Find("Kart"); originalRotation = childKart.transform.localRotation; rigidbody = gameObject.GetComponent <Rigidbody>(); boxCollider = gameObject.GetComponent <BoxCollider>(); kartInformation = gameObject.transform.Find("Kart").GetComponent <KartInformation>(); //stats defaultMaxSpeed = 65; maxSpeed = defaultMaxSpeed; maxSpeedChange = 0; maxReverse = 15; turnSpeed = 100; acceleration = 0.25f; brakeForce = 0.95f; engineDeceleration = 0.15f; spinSpeed = 250; stabilizeTorqueForce = 2000.0f; //common jumpLimit = 2.5f; state = new Stopped(this.gameObject); mainCamera = transform.FindChild("Main Camera").gameObject; pw = gameObject.GetComponent <PlayerNetwork>(); oldPosition = transform.position; groundNormal = Vector3.up; childKart.localPosition = new Vector3(0, 0, 0); childKart.localEulerAngles = new Vector3(0, -90, 0); lateInitialized = true; }
void LateInitialize() { defaultCameraPos = transform.Find("Main Camera").localPosition; targetCameraPos = defaultCameraPos; currentTextureSpeedModifier = 1.0f; childKart = transform.Find("Kart"); originalRotation = childKart.transform.localRotation; rigidbody = gameObject.GetComponent<Rigidbody>(); boxCollider = gameObject.GetComponent<BoxCollider>(); kartInformation = gameObject.transform.Find("Kart").GetComponent<KartInformation>(); //stats defaultMaxSpeed = 65; maxSpeed = defaultMaxSpeed; maxSpeedChange = 0; maxReverse = 15; turnSpeed = 100; acceleration = 0.25f; brakeForce = 0.95f; engineDeceleration = 0.15f; spinSpeed = 250; stabilizeTorqueForce = 2000.0f; //common jumpLimit = 2.5f; state = new Stopped(this.gameObject); mainCamera = transform.FindChild("Main Camera").gameObject; pw = gameObject.GetComponent<PlayerNetwork>(); oldPosition = transform.position; groundNormal = Vector3.up; childKart.localPosition = new Vector3(0, 0, 0); childKart.localEulerAngles = new Vector3(0, -90, 0); lateInitialized = true; }
public static PeEntity CreateDungeonMonster(int protoId, Vector3 pos, int dungeonId, int buffId = 0, int colorType = -1, int playerId = -1) { if (PeGameMgr.IsSingle) { PeEntity m = CreateAdMonster(protoId, pos, colorType, playerId, buffId, false); if (m != null) { m.SetAttribute(Pathea.AttribType.CampID, DungeonMonster.CAMP_ID); m.SetAttribute(Pathea.AttribType.DamageID, DungeonMonster.DAMAGE_ID); } else { Debug.LogError("createDungeonMonsterFailed!"); } return(m); } else { SceneEntityPosAgent agent = CreateAdAgent(pos, protoId, colorType, playerId, buffId, false); agent.entity = null; // Compute agent.protoId EntityGrp grp; EntityMonsterBeacon bcn; float exScale = -1.0f; if (!ParseAgentInfo(agent, out grp, out bcn, ref exScale, ref colorType, ref playerId, ref buffId)) { return(agent.entity); } NetworkManager.WaitCoroutine(PlayerNetwork.RequestCreateAi(agent.protoId, agent.Pos, null == grp ? -1 : grp.Id, null == bcn ? -1 : bcn.Id, dungeonId, colorType, playerId, buffId)); return(agent.entity); } }
public static void AddJoinRequest(int teamId, PlayerNetwork player) { if (!joinReqeust.Contains(player)) { joinReqeust.Add(player); } }
public void RemoveMember(PlayerNetwork player) { if (Members.Contains(player)) { Members.Remove(player); } }
public void AddMember(PlayerNetwork player) { if (!Members.Contains(player)) { Members.Add(player); } }
private void OnTriggerEnter(Collider other) { // Don't do anything without authority if (!hasAuthority) { return; } // Damage remote players // TODO: Make this actually work if (other.gameObject.layer == LayerMask.NameToLayer("RemotePlayer")) { PlayerNetwork playerNetwork = other.GetComponent <PlayerNetwork>(); if (playerNetwork == null) { Debug.LogError("Player does not have a PlayerNetwork script!"); } else { playerNetwork.RpcTakeDamage(5); } } // Calls CmdDestroyBullet() if object hit is not in layersToIgnore if (((1 << other.gameObject.layer) & layersToIgnore) == 0 && hasAuthority) { CmdDestroyBullet(); } }
private void Spawn(PlayerNetwork player) { int id = player.clientId; Vector3 position = player.posPlayer.First(); if (id != clientId) { if (id < 1000) { if (!spectator) { objects.Add((GameObject)UnityEngine.Object.Instantiate(lowResSpherePrefab, position, Quaternion.identity)); } else { objects.Add((GameObject)UnityEngine.Object.Instantiate(spherePrefab, position, Quaternion.identity)); } } else { objects.Add((GameObject)UnityEngine.Object.Instantiate(emptyPrefab, position, Quaternion.identity)); } } else if (!spectator) { objects.Add((GameObject)UnityEngine.Object.Instantiate(playerPrefab, position, Quaternion.identity)); } else { objects.Add((GameObject)UnityEngine.Object.Instantiate(spectatorPrefab, position, Quaternion.identity)); } }
private void CreatPlayers(int pageIndex)//players { ClearSelected(); //lz-2016.10.23 错误 #5104 crash bug if (null == AllPlayers || AllPlayers.Count <= 0) { return; } List <PlayerNetwork> lis = new List <PlayerNetwork>(); if (pageIndex < PlayersPageCount - 1)//没到最后一页 { lis = AllPlayers.GetRange(pageIndex * PlayersPerPageCount, PlayersPerPageCount); } else if (pageIndex == PlayersPageCount - 1) //到了最后一页 { if (PlayersPageCount * PlayersPerPageCount > AllPlayers.Count) //最后一页未满 { lis = AllPlayers.GetRange(pageIndex * PlayersPerPageCount, AllPlayers.Count % PlayersPerPageCount); } else if (PlayersPageCount * PlayersPerPageCount == AllPlayers.Count)//最后一页满的 { lis = AllPlayers.GetRange(pageIndex * PlayersPerPageCount, PlayersPerPageCount); } } if (null == lis || lis.Count <= 0) { return; } //lz-2016.11.10 Crash Bug if (null == PlayersPageList || PlayersPageList.Count <= 0) { return; } foreach (CSUI_TeamListItem i in PlayersPageList) { if (null != i) { i.ClearInfo(); } } for (int i = 0; i < lis.Count; i++) { if (i < PlayersPageList.Count) { //lz-2016.11.28 错误 #7061 Crash bug PlayerNetwork playerNetwork = lis[i]; if (null != playerNetwork && null != playerNetwork.Battle) { PlayersPageList[i].SetInfo(playerNetwork.TeamId, playerNetwork.RoleName, playerNetwork.Battle._killCount, playerNetwork.Battle._deathCount, playerNetwork.Battle._point, playerNetwork); } } } mPlayersPageCountText.text = (PlayersPageIndex + 1).ToString() + "/" + PlayersPageCount.ToString(); }
void CmdPlayerShot(string playerID, int damage) { Debug.Log(playerID + " has been shot"); PlayerNetwork playerNetwork = GameManager.GetPlayer(playerID); playerNetwork.TakeDamage(damage); }
private void Start() { _rb = GetComponent <Rigidbody>(); _pc = GetComponent <PlayerConstant>(); _pn = GetComponent <PlayerNetwork>(); _pm = GetComponent <PlayerMain>(); _pa = transform.Find("Model").GetComponent <PlayerAnimation>(); }
private void Awake() { Instance = this; PhotonView = GetComponent <PhotonView>(); PlayerName = "NameHere"; PhotonNetwork.sendRate = 60; PhotonNetwork.sendRateOnSerialize = 60; }
void Awake() { Instance = this; PhotonView = GetComponent <PhotonView>(); PhotonNetwork.sendRate = 60; PhotonNetwork.sendRateOnSerialize = 30; SceneManager.sceneLoaded += OnSceneFinishedLoading; }
public virtual void FindPlayer() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerNetwork>(); if (!player) { Debug.LogError("Could not locate player! Check to see if the player is in the scene, tagged as 'Player', and has the PlayerNetwork (or some derivative behavior) attached.", this); } }
// Use this for initialization void Awake() { Instance = this; playerName = "DefaultName"; photonView = GetComponent <PhotonView>(); SceneManager.sceneLoaded += OnSceneFinishedLoading; }
void NetSendEndMsg(PEAbnormalType type) { if (!PeGameMgr.IsMulti || !m_Net.IsController) { return; } PlayerNetwork.SyncAbnormalConditionEnd(Entity.Id, (int)type); }
public override void OnStartClient() { base.OnStartClient(); string netID = GetComponent <NetworkIdentity>().netId.ToString(); PlayerNetwork playerNetwork = GetComponent <PlayerNetwork>(); GameManager.RegisterPlayer(netID, playerNetwork); }
public void Awake() { if (player) { Destroy(player.gameObject); } player = this; }
//Add more once we have more Player based scripts. public void Setup() { playerController = playerObj.GetComponent<PlayerController>(); playerMouseRotator = playerObj.GetComponent<MouseRotator>(); playerNetwork = playerObj.GetComponent<PlayerNetwork>(); playerNetwork.lobbyName = playerName; playerNetwork.pColor = syncColor; playerNetwork.playerNumber = playerID; }
public override void Show() { if ((_userController.GetPlayer().IsActive == false) && (_userController.GetDead() == false)) { _weapon = _userController.GetPlayer().PlayerWeapon; _playerNetwork = _userController.GetPlayer().PlayerNetwork; UpdateWeaponUi(); PlayerNameText.text = _playerNetwork.GetUserModel().UserName; base.Show(); } }
void OnCollisionEnter(Collision col) { ContactPoint cp = col.contacts[0]; GameObject GG = col.gameObject; if (GG.tag == "Player") { PN = GG.GetComponent<PlayerNetwork>(); PN.RpcApplyStatusEffectClient(StatusEffectHandler.EffectType.HIT); PN.GetStatusEffectHandler().AddStatusEffect(StatusEffectHandler.EffectType.HIT); GameObject.Instantiate(explosionPrefab, transform.position, new Quaternion()); Destroy(gameObject); } }
void OnCollisionEnter(Collision col) { ContactPoint cp = col.contacts[0]; GameObject GG = col.gameObject; rb.velocity = Vector3.Reflect(oldVel, cp.normal); rb.velocity += cp.normal * 2.0f; Vector3 tempVel = rb.velocity; tempVel.y = 0.0f; rb.velocity = tempVel; if(GG.tag == "Player") { PN = GG.GetComponent<PlayerNetwork>(); PN.RpcApplyStatusEffectClient(StatusEffectHandler.EffectType.HIT); PN.GetStatusEffectHandler().AddStatusEffect(StatusEffectHandler.EffectType.HIT); Destroy(gameObject); } }
private void Awake() { m_rigidbody = GetComponent<Rigidbody2D>(); m_playerNetwork = GetComponent<PlayerNetwork>(); m_aimDirection = Vector2.right; }
void Start() { _playerNetwork = GetComponent<PlayerNetwork>(); _unitID = GetComponent<Unit_ID>(); }
// void Start() { playerNetwork = GetComponent<PlayerNetwork>(); playerRigidbody = GetComponent<Rigidbody2D>(); playerMovement = GetComponent<PlayerMovement>(); anim = GetComponent<NetworkAnimator>().animator; startingGravity = playerRigidbody.gravityScale; startingSpeed = playerMovement.playerSpeed; if (playerNetwork.playerCharacter == PlayerNetwork.Character.Kirito) { crouchComboIndex = 3; comboIndex = 4; } }