public RemotePlayer(GameObject playerBody, PlayerContext playerContext, List <TechType> equippedTechTypes, PlayerModelManager playerModelManager) { Body = playerBody; PlayerContext = playerContext; equipment = new HashSet <TechType>(equippedTechTypes); this.playerModelManager = playerModelManager; Body.name = PlayerName; RigidBody = Body.AddComponent <Rigidbody>(); RigidBody.useGravity = false; // Get player PlayerModel = Body.RequireGameObject("player_view"); // Move variables to keep player animations from mirroring and for identification ArmsController = PlayerModel.GetComponent <ArmsController>(); ArmsController.smoothSpeedUnderWater = 0; ArmsController.smoothSpeedAboveWater = 0; AnimationController = PlayerModel.AddComponent <AnimationController>(); playerModelManager.AttachPing(this); playerModelManager.BeginApplyPlayerColor(this); UpdateEquipmentVisibility(); ErrorMessage.AddMessage($"{PlayerName} joined the game."); }
public RemotePlayer(GameObject playerBody, PlayerContext playerContext, List <TechType> equippedTechTypes, List <Pickupable> inventoryItems, PlayerModelManager modelManager) { PlayerContext = playerContext; Body = playerBody; Body.name = PlayerName; equipment = new HashSet <TechType>(equippedTechTypes); RigidBody = Body.AddComponent <Rigidbody>(); RigidBody.useGravity = false; NitroxEntity.SetNewId(Body, playerContext.PlayerNitroxId); // Get player PlayerModel = Body.RequireGameObject("player_view"); // Move variables to keep player animations from mirroring and for identification ArmsController = PlayerModel.GetComponent <ArmsController>(); ArmsController.smoothSpeedUnderWater = 0; ArmsController.smoothSpeedAboveWater = 0; // ConditionRules has Player.Main based conditions from ArmsController PlayerModel.GetComponent <ConditionRules>().enabled = false; AnimationController = PlayerModel.AddComponent <AnimationController>(); Transform inventoryTransform = new GameObject("Inventory").transform; inventoryTransform.SetParent(Body.transform); Inventory = new ItemsContainer(6, 8, inventoryTransform, "NitroxInventoryStorage_" + PlayerName, null); foreach (Pickupable item in inventoryItems) { Inventory.UnsafeAdd(new InventoryItem(item)); Log.Debug($"Added {item.name} to {playerContext.PlayerName}."); } ItemAttachPoint = PlayerModel.transform.Find(PlayerEquipmentConstants.ITEM_ATTACH_POINT_GAME_OBJECT_NAME); playerModelManager = modelManager; playerModelManager.AttachPing(this); playerModelManager.BeginApplyPlayerColor(this); playerModelManager.RegisterEquipmentVisibilityHandler(PlayerModel); UpdateEquipmentVisibility(); ErrorMessage.AddMessage($"{PlayerName} joined the game."); }
public RemotePlayer(GameObject playerBody, PlayerContext playerContext) { Body = playerBody; PlayerContext = playerContext; RigidBody = Body.AddComponent <Rigidbody>(); RigidBody.useGravity = false; // Get player PlayerModel = Body.RequireGameObject("player_view"); // Move variables to keep player animations from mirroring and for identification ArmsController = PlayerModel.GetComponent <ArmsController>(); ArmsController.smoothSpeedUnderWater = 0; ArmsController.smoothSpeedAboveWater = 0; AnimationController = PlayerModel.AddComponent <AnimationController>(); ErrorMessage.AddMessage($"{PlayerName} joined the game."); }