void InitRayCastTarget(PlayerEntity player) { var target = RayCastTargetUtil.AddRayCastTarget(player.RootGo()); PlayerCastData.Make(target, player.entityKey.Value.EntityId); player.hasAddRaycast = true; }
protected override void DoSetData(PointerData data) { _playerId = PlayerCastData.EntityId(data.IdList); var playerEntity = _playerContext.GetEntityWithEntityKey(new Core.EntityComponent.EntityKey(_playerId, (short)EEntityType.Player)); if (null != playerEntity && playerEntity.hasGamePlay) { var player = _playerContext.flagSelfEntity; if (player.gamePlay.IsLifeState(EPlayerLifeState.Alive) && !player.gamePlay.IsSave && //自己是活着 playerEntity.playerInfo.TeamId == player.playerInfo.TeamId && !playerEntity.gamePlay.IsBeSave && //是队友 playerEntity.gamePlay.IsLifeState(EPlayerLifeState.Dying) && //队友是受伤状态 Vector3.Distance(player.position.Value, playerEntity.position.Value) <= SharedConfig.MaxSaveDistance //距离 ) { Tip = string.Format(ScriptLocalization.client_actiontip.saveplayer, playerEntity.playerInfo.PlayerName); } } }
public void InitKeyBinding() { var receiver = new PointerReceiver(UiConstant.maxMapWindowLayer, BlockType.None); receiver.AddAction(UserInputKey.PickUpTip, (data) => { var pointerData = data; var type = pointerData.IdList[0]; switch ((ECastDataType)type) { case ECastDataType.Player: selectedPlayerId = PlayerCastData.EntityId(data.IdList); //Debug.Log(selectedPlayerId); break; default: selectedPlayerId = 0; break; } }); playerInfoUIAdapter.RegisterPointerReceive(receiver); }