public void SpawnItemIntoWorld(Vector3 posToSpawn, float playerLuck, bool chestInPool = true) { if (!PhotonNetwork.isMasterClient) { return; } float randomValue = UnityEngine.Random.Range(0.0f, 1.0f); //determine if it's possible to spawn an item this time round DroppableItems itemToSpawn = DroppableItems.Chest; //if chests are in the pool then spawn using the following function if (chestInPool) { if (randomValue > DropRate + playerLuck) { return; } //get a random droppable item itemToSpawn = PickupDetails.GetRandomItem(); } else { itemToSpawn = PickupDetails.GetRandomNonChestItem(); } SpawnItem(posToSpawn, itemToSpawn); }
protected void ToString(List <string> toStringOutput) { toStringOutput.Add($"Uid = {(Uid == null ? "null" : Uid == string.Empty ? "" : Uid)}"); toStringOutput.Add($"Type = {(Type == null ? "null" : Type.ToString())}"); toStringOutput.Add($"State = {(State == null ? "null" : State.ToString())}"); toStringOutput.Add($"Metadata = {(Metadata == null ? "null" : Metadata.ToString())}"); toStringOutput.Add($"PickupDetails = {(PickupDetails == null ? "null" : PickupDetails.ToString())}"); toStringOutput.Add($"ShipmentDetails = {(ShipmentDetails == null ? "null" : ShipmentDetails.ToString())}"); }
public void SpawnItemFromRoom(Vector3 posToSpawn, float playerLuck, RoomType roomType) { if (!PhotonNetwork.isMasterClient) { return; } DroppableItems itemToSpawn = PickupDetails.GetDroppableItemFromRoom(roomType, playerLuck); //if the item wasn't set that means that the room that was cleared was a room that cannot spawn items, so we return if (itemToSpawn == DroppableItems.NULL) { return; } SpawnItem(posToSpawn, itemToSpawn); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is OrderFulfillment other && ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) && ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) && ((State == null && other.State == null) || (State?.Equals(other.State) == true)) && ((Metadata == null && other.Metadata == null) || (Metadata?.Equals(other.Metadata) == true)) && ((PickupDetails == null && other.PickupDetails == null) || (PickupDetails?.Equals(other.PickupDetails) == true)) && ((ShipmentDetails == null && other.ShipmentDetails == null) || (ShipmentDetails?.Equals(other.ShipmentDetails) == true))); }
private void SpawnItem(Vector3 positionToSpawn, DroppableItems itemToSpawn) { GameObject itemMesh = ObjectPoolManager.Instance.GetObjectFromNetworkPool(itemToSpawn.ToString()); //chests behave differently then regular pick up items but can still be dropped so they get managed here if (itemToSpawn == DroppableItems.Chest) { ChestItemMesh chest = itemMesh.GetComponent <ChestItemMesh>(); //get the closest position to the ground and place the chest in that location chest.transform.position = MathFunc.CalculateClosestGroundPosition(positionToSpawn); chest.SetActive(true); } //other 3D items that are not chests else { ItemMesh3D item = itemMesh.GetComponent <ItemMesh3D>(); //set the item assembly of the item item.AssemblyName = PickupDetails.GetDroppableItemAssembly(itemToSpawn); if (!m_PickUpItemsInGame.ContainsKey(item.AssemblyName)) { photonView.RPC("RPCCreateAndAddItemToList", PhotonTargets.All, item.AssemblyName); } float speed = UnityEngine.Random.Range(5.0f, 7.5f); Vector3 direction = Vector3.up; direction.x = UnityEngine.Random.Range(-0.25f, 0.25f); direction.z = UnityEngine.Random.Range(-0.25f, 0.25f); item.SetActive(true, positionToSpawn, Quaternion.identity.eulerAngles, direction, speed); object actualItem = GetObjectFromName(item.AssemblyName); item.photonView.RPC("Item3DSetUp", PhotonTargets.All, item.AssemblyName, (actualItem as AbstractItem).ItemType, (actualItem as AbstractItem).SpriteName, false); item.CanPlayerObtainItem = (actualItem as AbstractItem).CanObtainItem; } }
public override int GetHashCode() { int hashCode = -1081474364; if (Uid != null) { hashCode += Uid.GetHashCode(); } if (Type != null) { hashCode += Type.GetHashCode(); } if (State != null) { hashCode += State.GetHashCode(); } if (Metadata != null) { hashCode += Metadata.GetHashCode(); } if (PickupDetails != null) { hashCode += PickupDetails.GetHashCode(); } if (ShipmentDetails != null) { hashCode += ShipmentDetails.GetHashCode(); } return(hashCode); }