/// <summary> /// Tries to spawn at the specified position, does not spawn if position is not valid (impassable) /// </summary> private void TrySpawn() { Vector3Int position = cursorObject.transform.position.RoundToInt(); position.z = 0; if (MatrixManager.IsPassableAt(position, true)) { if (CustomNetworkManager.IsServer) { if (hier != null) { ClothFactory.CreateCloth(hier, position); } else { PoolManager.PoolNetworkInstantiate(prefab, position); } } else { if (hier != null) { DevSpawnMessage.Send(hier, true, (Vector3)position); } else { DevSpawnMessage.Send(prefab.name, false, (Vector3)position); } } } }
/// <summary> /// Initializes it to display the document /// </summary> /// <param name="resultDoc">document to display</param> public void Initialize(Document resultDoc) { if (resultDoc.Get("type").Equals(DevSpawnerDocument.PREFAB_TYPE)) { prefab = PoolManager.GetPrefabByName(resultDoc.Get("name")); Sprite toUse = prefab.GetComponentInChildren <SpriteRenderer>()?.sprite; if (toUse != null) { image.sprite = toUse; } detailText.text = "Prefab"; } else { hier = resultDoc.Get("hier"); Sprite toUse = UniItemUtils.GetInventoryIconSprite(hier); if (toUse != null) { image.sprite = toUse; } //determine which prefab this is for GameObject prefab = ClothFactory.GetClothPrefabForHier(hier); detailText.text = $"{prefab.name}\n{hier}"; } titleText.text = resultDoc.Get("name"); }
public void deleteCharacterComponent2() { UnityEngine.Object.Destroy(this.part_eye); UnityEngine.Object.Destroy(this.part_face); UnityEngine.Object.Destroy(this.part_glass); UnityEngine.Object.Destroy(this.part_hair); if (!this.isDeadBody) { ClothFactory.DisposeObject(this.part_hair_1); } UnityEngine.Object.Destroy(this.part_upper_body); UnityEngine.Object.Destroy(this.part_arm_l); UnityEngine.Object.Destroy(this.part_arm_r); if (!this.isDeadBody) { ClothFactory.DisposeObject(this.part_hair_2); ClothFactory.DisposeObject(this.part_cape); } UnityEngine.Object.Destroy(this.part_brand_1); UnityEngine.Object.Destroy(this.part_brand_2); UnityEngine.Object.Destroy(this.part_brand_3); UnityEngine.Object.Destroy(this.part_brand_4); UnityEngine.Object.Destroy(this.part_chest_1); UnityEngine.Object.Destroy(this.part_chest_2); UnityEngine.Object.Destroy(this.part_chest_3); UnityEngine.Object.Destroy(this.part_3dmg); UnityEngine.Object.Destroy(this.part_3dmg_belt); UnityEngine.Object.Destroy(this.part_3dmg_gas_l); UnityEngine.Object.Destroy(this.part_3dmg_gas_r); UnityEngine.Object.Destroy(this.part_blade_l); UnityEngine.Object.Destroy(this.part_blade_r); }
public void createHead2() { UnityEngine.Object.Destroy(this.part_eye); UnityEngine.Object.Destroy(this.part_face); UnityEngine.Object.Destroy(this.part_glass); UnityEngine.Object.Destroy(this.part_hair); if (!this.isDeadBody) { ClothFactory.DisposeObject(this.part_hair_1); } this.createHair2(); if (this.myCostume.eye_mesh.Length > 0) { this.part_eye = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Character/" + this.myCostume.eye_mesh)); this.part_eye.transform.position = this.part_head.transform.position; this.part_eye.transform.rotation = this.part_head.transform.rotation; this.part_eye.transform.parent = base.transform.Find("Amarture/Controller_Body/hip/spine/chest/neck/head").transform; this.setFacialTexture(this.part_eye, this.myCostume.eye_texture_id); } if (this.myCostume.beard_texture_id >= 0) { this.createFace(); this.setFacialTexture(this.part_face, this.myCostume.beard_texture_id); } if (this.myCostume.glass_texture_id >= 0) { this.createGlass(); this.setFacialTexture(this.part_glass, this.myCostume.glass_texture_id); } this.part_head.renderer.material = CharacterMaterials.materials[this.myCostume.skin_texture]; this.part_chest.renderer.material = CharacterMaterials.materials[this.myCostume.skin_texture]; }
public void PutOn(ClothModel cm) { OnCount = 1; ICloths ich = ClothFactory.CreatCloth(resType, umaContext, characterData, characterSlotOverlay, character, characterBase, cm); cloths.Add(ich); ich.PutOn(OnFinish); }
public void TakeOffAll() { List <ClothModel> avs = new List <ClothModel>(characterData.avatars); OffCount = avs.Count; for (int i = 0; i < avs.Count; i++) { ICloths ich = ClothFactory.CreatCloth(resType, umaContext, characterData, characterSlotOverlay, character, characterBase, avs[i]); ich.TakeOff(OffFinish); } }
public void InitializePool() { if (ClothFactoryReference == null) { ClothFactoryReference = UnityEngine.Object.FindObjectOfType <ClothFactory>(); } if (ClothFactoryReference != null) { if (ClothFactoryReference.RaceData.ContainsKey(this.name)) { Logger.LogError("a PlayerTextureData Has the same name as another one name " + this.name + " Please rename one of them to a different name"); } ClothFactoryReference.RaceData[this.name] = this; } }
public void PutOn(List <ClothModel> cms, bool isInitialze = false) { OnCount = cms.Count; for (int i = 0; i < cms.Count; i++) { ICloths ich = ClothFactory.CreatCloth(resType, umaContext, characterData, characterSlotOverlay, character, characterBase, cms[i]); cloths.Add(ich); if (isInitialze) { ich.Initilze(OnFinish); } else { ich.PutOn(OnFinish); } } }
public override IEnumerator Process() { //TODO: Validate if player is allowed to spawn things, check if they have admin privs. //For now we will let anyone spawn. if (MatrixManager.IsPassableAt(WorldPosition.RoundToInt())) { if (!IsUniCloth) { PoolManager.PoolNetworkInstantiate(Name, WorldPosition); } else { ClothFactory.CreateCloth(Name, WorldPosition); } } yield return(null); }
private void OnLevelWasLoaded(int level) { if (level == 0) { return; } if (Application.loadedLevelName == "characterCreation" || Application.loadedLevelName == "SnapShot") { return; } var array = GameObject.FindGameObjectsWithTag("titan"); foreach (var go in array) { if (go.GetPhotonView() == null || !go.GetPhotonView().owner.IsMasterClient) { Destroy(go); } } gameStart = true; Pool.Clear(); RespawnPositions.Dispose(); ShowHUDInfoCenter(string.Empty); var gameObject2 = (GameObject)Instantiate(CacheResources.Load("MainCamera_mono"), CacheGameObject.Find("cameraDefaultPosition").transform.position, CacheGameObject.Find("cameraDefaultPosition").transform.rotation); Destroy(CacheGameObject.Find("cameraDefaultPosition")); gameObject2.name = "MainCamera"; Screen.lockCursor = true; Screen.showCursor = true; var ui = (GameObject)Instantiate(CacheResources.Load("UI_IN_GAME")); ui.name = "UI_IN_GAME"; ui.SetActive(true); UIRefer = ui.GetComponent <UIReferArray>(); NGUITools.SetActive(UIRefer.panels[0], true); NGUITools.SetActive(UIRefer.panels[1], false); NGUITools.SetActive(UIRefer.panels[2], false); NGUITools.SetActive(UIRefer.panels[3], false); IN_GAME_MAIN_CAMERA.MainCamera.setHUDposition(); IN_GAME_MAIN_CAMERA.MainCamera.setDayLight(IN_GAME_MAIN_CAMERA.DayLight); var info = Level; ClothFactory.ClearClothCache(); logic.OnGameRestart(); PlayerList = new PlayerList(); if (IN_GAME_MAIN_CAMERA.GameType == GameType.Single) { LoadSkinCheck(); CustomLevel.OnLoadLevel(); singleKills = 0; singleMax = 0; singleTotal = 0; IN_GAME_MAIN_CAMERA.MainCamera.enabled = true; IN_GAME_MAIN_CAMERA.SpecMov.disable = true; IN_GAME_MAIN_CAMERA.Look.disable = true; IN_GAME_MAIN_CAMERA.GameMode = Level.Mode; SpawnPlayer(IN_GAME_MAIN_CAMERA.singleCharacter.ToUpper()); Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS; Screen.showCursor = false; var rate = 90; if (difficulty == 1) { rate = 70; } SpawnTitansCustom(rate, info.EnemyNumber); return; } PVPcheckPoint.chkPts = new ArrayList(); IN_GAME_MAIN_CAMERA.MainCamera.enabled = false; IN_GAME_MAIN_CAMERA.BaseCamera.GetComponent <CameraShake>().enabled = false; IN_GAME_MAIN_CAMERA.GameType = GameType.MultiPlayer; LoadSkinCheck(); CustomLevel.OnLoadLevel(); switch (info.Mode) { case GameMode.Trost: { CacheGameObject.Find("playerRespawn").SetActive(false); Destroy(CacheGameObject.Find("playerRespawn")); var gameObject3 = CacheGameObject.Find("rock"); gameObject3.animation["lift"].speed = 0f; CacheGameObject.Find("door_fine").SetActive(false); CacheGameObject.Find("door_broke").SetActive(true); Destroy(CacheGameObject.Find("ppl")); break; } case GameMode.BossFightCT: CacheGameObject.Find("playerRespawnTrost").SetActive(false); Destroy(CacheGameObject.Find("playerRespawnTrost")); break; } if (needChooseSide) { ShowHUDInfoTopCenterADD("\n\nPRESS 1 TO ENTER GAME"); } else { Screen.lockCursor = IN_GAME_MAIN_CAMERA.CameraMode >= CameraType.TPS; if (IN_GAME_MAIN_CAMERA.GameMode == GameMode.PVP_CAPTURE) { if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2) { checkpoint = CacheGameObject.Find("PVPchkPtT"); } else { checkpoint = CacheGameObject.Find("PVPchkPtH"); } } if ((int)PhotonNetwork.player.Properties[PhotonPlayerProperty.isTitan] == 2) { SpawnNonAiTitan(myLastHero); } else { SpawnPlayer(myLastHero); } } if (info.Mode == GameMode.BossFightCT) { Destroy(CacheGameObject.Find("rock")); } if (PhotonNetwork.IsMasterClient) { switch (info.Mode) { case GameMode.Trost: { if (!IsPlayerAllDead()) { var gameObject4 = Pool.NetworkEnable("TITAN_EREN_trost", new Vector3(-200f, 0f, -194f), Quaternion.Euler(0f, 180f, 0f)); gameObject4.GetComponent <TITAN_EREN>().rockLift = true; var rate2 = 90; if (difficulty == 1) { rate2 = 70; } var array3 = GameObject.FindGameObjectsWithTag("titanRespawn"); var gameObject5 = CacheGameObject.Find("titanRespawnTrost"); if (gameObject5 != null) { foreach (var gameObject6 in array3) { if (gameObject6.transform.parent.gameObject == gameObject5) { SpawnTitan(rate2, gameObject6.transform.position, gameObject6.transform.rotation); } } } } break; } case GameMode.BossFightCT: { if (!IsPlayerAllDead()) { Pool.NetworkEnable("COLOSSAL_TITAN", -Vectors.up * 10000f, Quaternion.Euler(0f, 180f, 0f)); } break; } case GameMode.KillTitan: case GameMode.EndlessTitan: case GameMode.SurviveMode: { if (info.Name == "Annie" || info.Name == "Annie II") { Pool.NetworkEnable("FEMALE_TITAN", CacheGameObject.Find("titanRespawn").transform.position, CacheGameObject.Find("titanRespawn").transform.rotation); } else { var rate3 = 90; if (difficulty == 1) { rate3 = 70; } SpawnTitansCustom(rate3, info.EnemyNumber); } break; } default: { if (info.Mode != GameMode.Trost) { if (info.Mode == GameMode.PVP_CAPTURE && Level.MapName == "OutSide") { var array5 = GameObject.FindGameObjectsWithTag("titanRespawn"); if (array5.Length <= 0) { return; } for (var k = 0; k < array5.Length; k++) { SpawnTitanRaw(array5[k].transform.position, array5[k].transform.rotation) .SetAbnormalType(AbnormalType.Crawler, true); } } } break; } } } if (!info.Supply) { Destroy(CacheGameObject.Find("aot_supply")); } if (!PhotonNetwork.IsMasterClient) { BasePV.RPC("RequireStatus", PhotonTargets.MasterClient); } if (Stylish != null) { Stylish.enabled = true; } if (Level.LavaMode) { Instantiate(CacheResources.Load("levelBottom"), new Vector3(0f, -29.5f, 0f), Quaternion.Euler(0f, 0f, 0f)); CacheGameObject.Find("aot_supply").transform.position = CacheGameObject.Find("aot_supply_lava_position").transform.position; CacheGameObject.Find("aot_supply").transform.rotation = CacheGameObject.Find("aot_supply_lava_position").transform.rotation; } if (GameModes.BombMode.Enabled) { if (Level.Name.StartsWith("The Forest")) { // Added the creation of an empty gameobject with MapCeilingObject as a component - Thyme 02/28/21 GameObject mapCeiling = new GameObject("MapCeilingPrefab"); mapCeiling.AddComponent <TLW.MapCeiling>(); mapCeiling.transform.position = new Vector3(0f, 280f, 0f); mapCeiling.transform.rotation = Quaternion.identity; mapCeiling.transform.localScale = new Vector3(1320f, 20f, 1320f); } else if (Level.Name.StartsWith("The City")) { GameObject mapCeiling = new GameObject("MapCeilingPrefab"); mapCeiling.AddComponent <TLW.MapCeiling>(); mapCeiling.transform.position = new Vector3(0f, 210f, 0f); mapCeiling.transform.rotation = Quaternion.identity; mapCeiling.transform.localScale = new Vector3(1400f, 20f, 1400f); } } roomInformation.UpdateLabels(); Resources.UnloadUnusedAssets(); }
public void SetPlayerLoadOuts() { JobOutfit standardOutfit = GameManager.Instance.StandardOutfit.GetComponent <JobOutfit>(); JobOutfit jobOutfit = GameManager.Instance.GetOccupationOutfit(playerScript.mind.jobType); Dictionary <EquipSlot, string> gear = new Dictionary <EquipSlot, string>(); gear.Add(EquipSlot.uniform, standardOutfit.uniform); gear.Add(EquipSlot.ear, standardOutfit.ears); gear.Add(EquipSlot.belt, standardOutfit.belt); gear.Add(EquipSlot.back, standardOutfit.backpack); gear.Add(EquipSlot.feet, standardOutfit.shoes); gear.Add(EquipSlot.eyes, standardOutfit.glasses); gear.Add(EquipSlot.hands, standardOutfit.gloves); gear.Add(EquipSlot.exosuit, standardOutfit.suit); gear.Add(EquipSlot.head, standardOutfit.head); //gear.Add(EquipSlot.accessory, standardOutfit.accessory); gear.Add(EquipSlot.mask, standardOutfit.mask); //gear.Add(EquipSlot.backpack, standardOutfit.backpack); //gear.Add(EquipSlot.satchel, standardOutfit.satchel); //gear.Add(EquipSlot.duffelbag, standardOutfit.duffelbag); //gear.Add(EquipSlot.box, standardOutfit.box); //gear.Add(EquipSlot.l_hand, standardOutfit.l_hand); //gear.Add(EquipSlot.l_pocket, standardOutfit.l_pocket); //gear.Add(EquipSlot.r_pocket, standardOutfit.r_pocket); //gear.Add(EquipSlot.suit_store, standardOutfit.suit_store); if (!string.IsNullOrEmpty(jobOutfit.uniform)) { gear[EquipSlot.uniform] = jobOutfit.uniform; } /*if (!String.IsNullOrEmpty(jobOutfit.id)) * gear[EquipSlot.id] = jobOutfit.id;*/ if (!string.IsNullOrEmpty(jobOutfit.ears)) { gear[EquipSlot.ear] = jobOutfit.ears; } if (!string.IsNullOrEmpty(jobOutfit.belt)) { gear[EquipSlot.belt] = jobOutfit.belt; } if (!string.IsNullOrEmpty(jobOutfit.backpack)) { gear[EquipSlot.back] = jobOutfit.backpack; } if (!string.IsNullOrEmpty(jobOutfit.shoes)) { gear[EquipSlot.feet] = jobOutfit.shoes; } if (!string.IsNullOrEmpty(jobOutfit.glasses)) { gear[EquipSlot.eyes] = jobOutfit.glasses; } if (!string.IsNullOrEmpty(jobOutfit.gloves)) { gear[EquipSlot.hands] = jobOutfit.gloves; } if (!string.IsNullOrEmpty(jobOutfit.suit)) { gear[EquipSlot.exosuit] = jobOutfit.suit; } if (!string.IsNullOrEmpty(jobOutfit.head)) { gear[EquipSlot.head] = jobOutfit.head; } /*if (!String.IsNullOrEmpty(jobOutfit.accessory)) * gear[EquipSlot.accessory] = jobOutfit.accessory;*/ if (!string.IsNullOrEmpty(jobOutfit.mask)) { gear[EquipSlot.mask] = jobOutfit.mask; } /*if (!String.IsNullOrEmpty(jobOutfit.backpack)) * gear[EquipSlot.backpack] = jobOutfit.backpack; * if (!String.IsNullOrEmpty(jobOutfit.satchel)) * gear[EquipSlot.satchel] = jobOutfit.satchel; * if (!String.IsNullOrEmpty(jobOutfit.duffelbag)) * gear[EquipSlot.duffelbag] = jobOutfit.duffelbag; * if (!String.IsNullOrEmpty(jobOutfit.box)) * gear[EquipSlot.box] = jobOutfit.box; * if (!String.IsNullOrEmpty(jobOutfit.l_hand)) * gear[EquipSlot.l_hand] = jobOutfit.l_hand; * if (!String.IsNullOrEmpty(jobOutfit.l_pocket)) * gear[EquipSlot.l_pocket] = jobOutfit.l_pocket; * if (!String.IsNullOrEmpty(jobOutfit.r_pocket)) * gear[EquipSlot.r_pocket] = jobOutfit.r_pocket; * if (!String.IsNullOrEmpty(jobOutfit.suit_store)) * gear[EquipSlot.suit_store] = jobOutfit.suit_store;*/ foreach (KeyValuePair <EquipSlot, string> gearItem in gear) { if (gearItem.Value.Contains(UniItemUtils.ClothingHierIdentifier) || gearItem.Value.Contains(UniItemUtils.HeadsetHierIdentifier) || gearItem.Value.Contains(UniItemUtils.BackPackHierIdentifier) || gearItem.Value.Contains(UniItemUtils.BagHierIdentifier)) { GameObject obj = ClothFactory.CreateCloth(gearItem.Value, TransformState.HiddenPos, transform.parent); //if ClothFactory does not return an object then move on to the next clothing item if (!obj) { Logger.LogWarning("Trying to instantiate clothing item " + gearItem.Value + " failed!", Category.Equipment); continue; } ItemAttributes itemAtts = obj.GetComponent <ItemAttributes>(); SetItem(gearItem.Key, itemAtts.gameObject); } else if (!string.IsNullOrEmpty(gearItem.Value)) { // Logger.Log(gearItem.Value + " creation not implemented yet."); } } SpawnID(jobOutfit); if (playerScript.mind.jobType == JobType.SYNDICATE) { //Check to see if there is a nuke and communicate the nuke code: Nuke nuke = FindObjectOfType <Nuke>(); if (nuke != null) { UpdateChatMessage.Send(gameObject, ChatChannel.Syndicate, "We have intercepted the code for the nuclear weapon: " + nuke.NukeCode); } } }
public void SpawnCloth() { ClothFactory.CreateCloth("", transform.position); }