public void PrintSpeed() { Raft raft = FindObjectOfType <Raft>(); object value = Traverse.Create(raft).Field("currentMovementSpeed").GetValue() as object; RConsole.Log(value.ToString()); }
private void Update() { if (_Player == null) { _Player = ComponentManager <Player> .Value; } if (_Network_Player == null) { _Network_Player = ComponentManager <Network_Player> .Value; } if (_AzureSkyController == null) { _AzureSkyController = UnityEngine.Object.FindObjectOfType <AzureSkyController>(); } if (_WeatherManager == null) { _WeatherManager = UnityEngine.Object.FindObjectOfType <WeatherManager>(); } if (_Raft == null) { _Raft = ComponentManager <Raft> .Value; } if (Cheat.fixTimeScale) { Time.timeScale = 0f; } else { if (!visible) { Time.timeScale = 1f; } } if (UnityEngine.Input.GetKeyDown(KeyCode.F3)) { ModAPI.Log.Write("Flying"); Cheat.FlyMode = !Cheat.FlyMode; } // if clicked button if (UnityEngine.Input.GetKeyDown(KeyCode.F1)) { ModAPI.Log.Write("Menü"); if (visible) { // menu is closed _Player.SetMouseLookScripts(true); Helper.SetCursorVisibleAndLockState(false, CursorLockMode.Locked); Time.timeScale = 1f; } else { // menu is open _Player.SetMouseLookScripts(false); Helper.SetCursorVisibleAndLockState(true, CursorLockMode.None); Time.timeScale = 0f; } visible = !visible; } }
protected override void OnTimerElapsed(TimeoutTimer timer) { if (timer == RaftTimer) { var raftOperationResult = Raft.OnTimerElapsed(); ProcessRaftResult(raftOperationResult, null); } }
protected override void OnInitialized() { base.OnInitialized(); Server.StartListening(Id); RaftTimer = new TimeoutTimer(this); var raftOperationResult = Raft.Start(); ProcessRaftResult(raftOperationResult); }
public override void WorldEvent_WorldLoaded() { Raft raft = ComponentManager <Raft> .Value; if (raft != null) { raft.maxSpeed = 20f; raft.maxVelocity = 20f; } }
private void onMenuChanged(object sender, MenuChangedEventArgs e) { if (e.NewMenu is ShopMenu shop) { if (shop.portraitPerson?.Name != "Pierre") { return; } var raft = new Raft(); shop.forSale.Add(raft); shop.itemPriceAndStock.Add(raft, new int[] { 5000, 1 }); } }
public static bool Prefix_Raft_DoFunction(Raft __instance, GameLocation location, ref int x, ref int y, int power, Farmer who) { //x = (int) who.lastClick.X; //y = (int) who.lastClick.Y; who.CanMove = true; /*Rectangle position = new Rectangle(x - 32, y - 32, 64, 64); * if (location.isCollidingPosition( position, Game1.viewport, true )) * { * Log.debug( "was colliding" ); * switch ( who.FacingDirection ) * { * case 0: y -= 64; break; * case 1: x += 64; break; * case 2: y += 64; break; * case 3: x -= 64; break; * } * }*/ if (!who.isRafting && location.doesTileHaveProperty(x / 64, y / 64, "Water", "Back") != null) { who.isRafting = true; Rectangle position = new Rectangle(x - 32, y - 32, 64, 64); /* * if ( location.isCollidingPosition( position, Game1.viewport, true ) ) * { * who.isRafting = false; * return false; * } */ int xo = 0, yo = 0; /*switch ( who.FacingDirection ) * { * case 0: yo -= 64; break; * case 1: xo += 64; break; * case 2: yo += 64; break; * case 3: xo -= 64; break; * }*/ who.xVelocity = who.FacingDirection == 1 ? 3f : (who.FacingDirection == 3 ? -3f : 0.0f); who.yVelocity = who.FacingDirection == 2 ? 3f : (who.FacingDirection == 0 ? -3f : 0.0f); who.Position = new Vector2(( float )(x - 32) + xo, ( float )(y - 32 - 32 - (y < who.getStandingY() ? 64 : 0)) + yo); Game1.playSound("dropItemInWater"); } __instance.CurrentParentTileIndex = __instance.IndexOfMenuItemView; return(false); }
public IEnumerator Start() { AssetBundleCreateRequest request = AssetBundle.LoadFromMemoryAsync(Convert.FromBase64String(embeddedAssetBundle.data)); yield return(request); assets = request.assetBundle; GameObject cylinderAsset = assets.LoadAsset <GameObject>("Cylinder"); marker = Instantiate(cylinderAsset); marker.transform.localScale = new Vector3(0.3f, 4f, 0.3f); Raft raft = ComponentManager <Raft> .Value; marker.transform.SetParent(raft.gameObject.transform, false); RConsole.Log("FindRaftCenter has been loaded!"); }
static bool Prefix(Raft __instance, ref Rigidbody ___body, ref float ___speed, ref StudioEventEmitter ___eventEmitter_idle, ref Vector3 ___previousPosition) { if (!Semih_Network.IsHost) { return(false); } if (!__instance.IsAnchored && ___speed != 0f) { __instance.moveDirection = Vector3.forward; List <Sail> allSails = Sail.AllSails; Vector3 vector = Vector3.zero; int i = 0; int num = 1; while (i < allSails.Count) { Sail sail = allSails[i]; if (sail.open) { vector += sail.GetNormalizedDirection() * (float)(num / Math.Pow(num, rate)); } i++; num++; } if (vector.z < 0f) { vector.z = ((Mathf.Abs(vector.x) <= 0.7) ? -0.8f : (__instance.moveDirection.z = 0f)); } __instance.moveDirection += vector; ___body.AddForce(__instance.moveDirection * ___speed); } if (___body.velocity.sqrMagnitude > __instance.maxVelocity) { ___body.velocity = Vector3.ClampMagnitude(___body.velocity, __instance.maxVelocity); } ___eventEmitter_idle.SetParameter("velocity", ___body.velocity.sqrMagnitude / __instance.maxVelocity); ___previousPosition = ___body.transform.position; return(false); }
protected override void OnMessageReceived(INetworkSocket channel, object message) { RaftMessageBase raftMessage = message as RaftMessageBase; if (raftMessage is AppendEntriesRPC <string> ) { leaderChannel = channel; } Message messageFromClient = message as Message; if (messageFromClient != null) { if (Raft.State == RaftNodeState.Leader) { raftMessage = new ClientRequestRPC <string>() { Message = messageFromClient.Operation, SequenceNumber = 0 }; } else { if (leaderChannel != null) { SendMessage(leaderChannel, messageFromClient); } // forward message to leader } } if (raftMessage != null) { var raftOperationResult = Raft.OnMessageReceived(raftMessage); ProcessRaftResult(raftOperationResult, channel); } }
public void OnModUnload() { Debug.Log(UnLoaded); if (!Raft_Network.InMenuScene) { Raft raft = ComponentManager <Raft> .Value; if (raft != null) { var defaultRaftSpeed = defaultSpeed * defaultRaft; raft.maxSpeed = defaultRaftSpeed; raft.maxVelocity = defaultRaftSpeed; raft.waterDriftSpeed = defaultRaftSpeed; changedRaft = defaultRaftSpeed; if (anchored) { } else { ComponentManager <Raft> .Value.RemoveAnchor(10); } } if (godmode) { GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.foodDecrementRateMultiplier = 1f; GameModeValueManager.GetCurrentGameModeValue().nourishmentVariables.thirstDecrementRateMultiplier = 1f; RAPI.GetLocalPlayer().Stats.stat_oxygen.SetOxygenLostPerSecond(1f); GameModeValueManager.GetCurrentGameModeValue().playerSpecificVariables.damageTakenMultiplier = 1f; } else { } RAPI.GetLocalPlayer().PersonController.normalSpeed = 3; RAPI.GetLocalPlayer().PersonController.sprintSpeed = 6; RAPI.GetLocalPlayer().PersonController.swimSpeed = 2; } }
private static void ForceAnchor() { if (Raft_Network.InMenuScene) { Debug.Log(Error + "Is In Lobby"); return; } Raft raft = ComponentManager <Raft> .Value; if (raft == null) { Debug.Log(Error + "NoRaft"); return; } anchored = !anchored; if (anchored) { ComponentManager <Raft> .Value.AddAnchor(false, null); } else { ComponentManager <Raft> .Value.RemoveAnchor(10); } }
static void Postfix(Raft __instance) { __instance.maxVelocity = 100f; }
//JsonSerializer a = new JsonSerializer(); public void loadData() { config = instance.Helper.Data.ReadJsonFile <ModData>($"data/{Constants.SaveFolderName}.json") ?? new ModData(); List <List <string> > itemInfo = config.itemInfo; maxTab = config.maxTab; cost = config.cost; int y = 0; int z = 1; invs[0] = Game1.player.Items; invs.Add(new List <Item>()); for (int i = 0; i < itemInfo.Count; i++) { if (y == 36) { invs.Add(new List <Item>()); z++; y = 0; } if (itemInfo[i][0] == "null") { invs[z].Add((null)); } else if (itemInfo[i][0] == "toolz") { Tool x = (Tool)null; if (itemInfo[i][1] == "0") { x = new Axe(); x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "1") { x = new Hoe(); } else if (itemInfo[i][1] == "2") { x = new FishingRod(int.Parse(itemInfo[i][2])); } else if (itemInfo[i][1] == "3") { x = new Pickaxe(); x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "4") { x = new WateringCan(); x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "5") { x = new MeleeWeapon(int.Parse(itemInfo[i][3])); //sprite index?? x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "6") { x = new Slingshot(); x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "7") { x = new Lantern(); //x.UpgradeLevel = int.Parse(itemInfo[i][2]); } else if (itemInfo[i][1] == "8") { x = new MagnifyingGlass(); } else if (itemInfo[i][1] == "9") { x = new MilkPail(); } else if (itemInfo[i][1] == "10") { x = new Pan(); } else if (itemInfo[i][1] == "11") { x = new Raft(); } else if (itemInfo[i][1] == "12") { x = new Seeds(itemInfo[i][2], int.Parse(itemInfo[i][3])); } else if (itemInfo[i][1] == "13") { x = new Shears(); } else if (itemInfo[i][1] == "14") { x = new Sword(itemInfo[i][2], int.Parse(itemInfo[i][3])); } else if (itemInfo[i][1] == "15") { x = new Wand(); } invs[z].Add(x); } else { StardewValley.Object x = new StardewValley.Object(int.Parse(itemInfo[i][0]), int.Parse(itemInfo[i][1])); //x.SpecialVariable = int.Parse(itemInfo[i][2]); //x.Category = int.Parse(itemInfo[i][3]); //x.Name = itemInfo[i][4]; //x.DisplayName = itemInfo[i][5]; invs[z].Add((Item)(x)); } y++; } }
private static bool Prefix ( Raft __instance, ref Rigidbody ___body, ref float ___currentMovementSpeed, ref float ___speed, ref float ___maxDistanceFromAnchorPoint, ref StudioEventEmitter ___eventEmitter_idle, ref Vector3 ___previousPosition, ref Vector3 ___moveDirection, ref Vector3 ___anchorPosition ) { if (!Semih_Network.IsHost) { return(false); } if (GameModeValueManager.GetCurrentGameModeValue().raftSpecificVariables.isRaftAlwaysAnchored) { return(false); } if (!__instance.IsAnchored) { if (___speed != 0f) { float openedSails = 0f; ___moveDirection = Vector3.forward; if (RaftVelocityManager.MotorDirection == Vector3.zero) { List <Sail> allSails = Sail.AllSails; Vector3 vector = Vector3.zero; for (int i = 0; i < allSails.Count; i++) { Sail sail = allSails[i]; if (sail.open) { openedSails++; vector += sail.GetNormalizedDirection(); } } if (vector.z < 0f) { if ((double)Mathf.Abs(vector.x) > 0.7) { vector.z = (___moveDirection.z = 0f); } else { vector.z = -0.8f; } } ___moveDirection += vector; } else { ___moveDirection = RaftVelocityManager.MotorDirection; } ___currentMovementSpeed = ___speed; if (RaftVelocityManager.MotorDirection != Vector3.zero) { ___currentMovementSpeed = RaftVelocityManager.motorSpeed; if (RaftVelocityManager.MotorWheelWeightStrength == MotorWheel.WeightStrength.Weak) { ___currentMovementSpeed *= 0.5f; } if (___currentMovementSpeed < ___speed) { ___currentMovementSpeed = ___speed; } } else { for (float i = 1; i < (openedSails + 1); i++) { ___currentMovementSpeed += (1.5f * (float)(i / Math.Pow(i, MoreSailsMoreSpeed.RaftFixedUpdatePatchRate))); } } if (___speed != 0f) { if (___currentMovementSpeed > __instance.maxSpeed) { ___currentMovementSpeed = __instance.maxSpeed; } ___moveDirection = Vector3.ClampMagnitude(___moveDirection, 1f); ___body.AddForce(___moveDirection * ___currentMovementSpeed); } } List <SteeringWheel> steeringWheels = RaftVelocityManager.steeringWheels; float num = 0f; foreach (SteeringWheel steeringWheel in steeringWheels) { num += steeringWheel.SteeringRotation; } num = Mathf.Clamp(num, -1f, 1f); if (num != 0f) { Vector3 torque = new Vector3(0f, Mathf.Tan(0.0174532924f * num), 0f) * __instance.maxSteeringTorque; ___body.AddTorque(torque, ForceMode.Acceleration); } } else if (__instance.transform.position.DistanceXZ(___anchorPosition) > ___maxDistanceFromAnchorPoint) { Vector3 vector2 = ___anchorPosition - __instance.transform.position; vector2.y = 0f; ___body.AddForce(vector2.normalized * 2f); } if (___body.velocity.sqrMagnitude > __instance.maxVelocity) { ___body.velocity = Vector3.ClampMagnitude(___body.velocity, __instance.maxVelocity); } ___eventEmitter_idle.SetParameter("velocity", ___body.velocity.sqrMagnitude / __instance.maxVelocity); ___previousPosition = ___body.transform.position; return(false); }
private static void setRaftSpeed(string[] args) { if (Raft_Network.InMenuScene) { Debug.Log(Error + "Is In Lobby"); return; } if (args.Length < 1) { Debug.Log(Error + "Unknown Speed"); return; } var value = float.Parse(args[0], CultureInfo.InvariantCulture); int raftSpeedint = 1; if (!int.TryParse(args[0], out raftSpeedint)) { decimal raftSpeedDefault = 1; if (!decimal.TryParse(args[0], out raftSpeedDefault)) { Debug.Log(Error + "Invalid Speed"); return; } Raft defaultr = ComponentManager <Raft> .Value; if ((float)raftSpeedDefault > 25.001f) { Debug.Log(Error + "Maximum Speed = 25.001"); return; } if ((float)raftSpeedDefault <= 0f) { Debug.Log(Error + "Minimum Speed = 1"); return; } if (defaultr != null) { var defaulted = defaultSpeed * ((float)raftSpeedDefault); defaultr.maxSpeed = defaulted; defaultr.maxVelocity = defaulted; defaultr.waterDriftSpeed = defaulted; changedRaft = defaulted; } return; } if (raftSpeedint > 25.001f) { Debug.Log(Error + "Maximum Speed = 25.001"); return; } if (raftSpeedint <= 0f) { Debug.Log(Error + "Minimum Speed = 1"); return; } Raft raft = ComponentManager <Raft> .Value; if (raft != null) { var moddedSpeed = defaultSpeed * raftSpeedint; raft.maxSpeed = moddedSpeed * 4; raft.maxVelocity = moddedSpeed; raft.waterDriftSpeed = moddedSpeed; changedRaft = moddedSpeed; } else { Debug.Log(Error + "NoRaft"); return; } }
// The Update() method is being called every frame. Have fun! public void Update() { DateTime currentTime = DateTime.UtcNow; Network_Player player = RAPI.getLocalPlayer(); Network_Host_Entities nhe = ComponentManager <Network_Host_Entities> .Value; Raft raft = ComponentManager <Raft> .Value; Rigidbody body = Traverse.Create(raft).Field("body").GetValue() as Rigidbody; RewardData reward; if (rewardsQueue.TryDequeue(out reward)) { switch (reward.action) { case "sound": system.playSound(sounds[reward.args[0]], channels, false, out newChannel); break; case "message": chat.SendChatMessage(string.Join(" ", reward.args), SteamUser.GetSteamID()); break; case "item": Item_Base item = ItemManager.GetItemByName(reward.args[0]); int amount = 1; int.TryParse(reward.args[1], out amount); Helper.DropItem(new ItemInstance(item, amount, item.MaxUses), player.transform.position, player.CameraTransform.forward, player.transform.ParentedToRaft()); break; case "inventory_bomb": chat.SendChatMessage("Inventory Bomb!", SteamUser.GetSteamID()); foreach (Slot s in player.Inventory.allSlots) { player.Inventory.DropItem(s); } foreach (Slot s in player.Inventory.equipSlots) { player.Inventory.DropItem(s); } break; case "stat_edit": //TODO //player.PersonController.gravity = 20; //player.PersonController.swimSpeed = 2; //player.PersonController.normalSpeed = 3; //player.PersonController.jumpSpeed = 8; //player.Stats.stat_thirst.Value -= 5; string action = reward.args[0]; string stat = reward.args[1]; float changeAmount = 1; float.TryParse(reward.args[2], out changeAmount); int duration = 1; int.TryParse(reward.args[3], out duration); bool contained = false; foreach (StatData data in statsEdited) { if (data.stat.Equals(stat)) { data.duration += duration; contained = true; } } if (!contained) { StatData data = getStatData(player, stat, action, changeAmount); data.duration = duration * 1000; data.timeStarted = DateTime.UtcNow; setStatVal(player, stat, data.currentValue); if (duration != -1) { statsEdited.Add(data); } } break; case "move": push = true; pushData = new PushData(new Vector3(-4, 0, -4.3f), currentTime, 250); break; case "spawn_entity": Vector3 pos = player.FeetPosition; float scale = 1; if (reward.args.Length > 1) { float.TryParse(reward.args[1], out scale); } int amountFromEntries = 1; if (reward.args.Length > 2) { int.TryParse(reward.args[2], out amountFromEntries); } int spawnDuration = 1; if (reward.args.Length > 3) { int.TryParse(reward.args[3], out spawnDuration); } TempEntity tempEnt; uint objIndex = SaveAndLoad.GetUniqueObjectIndex(); for (int index = 0; index < amountFromEntries; ++index) { switch (reward.args[0]) { case "stone_bird": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.StoneBird, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "puffer_fish": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.PufferFish, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "llama": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Llama, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate(); break; case "goat": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Goat, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate(); break; case "chicken": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Chicken, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); (tempEnt.ent as AI_NetworkBehaviour_Domestic).QuickTameLate(); break; case "boar": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Boar, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "rat": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Rat, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "shark": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Shark, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "bear": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.Bear, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "mama_bear": tempEnt = new TempEntity(nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.MamaBear, pos, scale, objIndex, SaveAndLoad.GetUniqueObjectIndex(), null)); break; case "seagull": //TODO: It's not like the others for some reason..... tempEnt = null; break; default: tempEnt = null; break; } if (tempEnt != null && spawnDuration != -1) { Semih_Network network = ComponentManager <Semih_Network> .Value; Message_CreateAINetworkBehaviour networkBehaviour2 = new Message_CreateAINetworkBehaviour(Messages.CreateAINetworkBehaviour, network.NetworkIDManager, objIndex, pos, tempEnt.ent, null); if (network == null) { network = ComponentManager <Semih_Network> .Value; } network.RPC(networkBehaviour2, Target.Other, EP2PSend.k_EP2PSendReliable, NetworkChannel.Channel_Game); tempEnt.spawned = DateTime.UtcNow; tempEnt.duration = spawnDuration * 1000; tempEntities.Add(tempEnt); } } break; case "set_weather": string weatherName = reward.args[0]; bool instant; bool.TryParse(reward.args[1], out instant); WeatherManager wm = ComponentManager <WeatherManager> .Value; Randomizer weather = Traverse.Create(ComponentManager <WeatherManager> .Value).Field("weatherConnections").GetValue() as Randomizer; Weather w = null; foreach (Weather we in weather.GetAllItems <Weather>()) { if (we.name.Equals(weatherName)) { w = we; } } if (w != null) { wm.StopAllCoroutines(); wm.StartCoroutine(wm.StartNewWeather(w, instant)); } break; case "set_time": AzureSkyController skyController = ComponentManager <AzureSkyController> .Value; int hours = 1; int.TryParse(reward.args[0], out hours); int minutes = 1; int.TryParse(reward.args[1], out minutes); skyController.timeOfDay.GotoTime(hours, minutes); break; case "pickup_trash": WaterFloatSemih2[] floatingObjects = FindObjectsOfType <WaterFloatSemih2>(); float radius = 100; float.TryParse(reward.args[0], out radius); foreach (WaterFloatSemih2 trash in floatingObjects) { try { if (!trash.GetComponent <PickupItem>().isDropped&& Vector3.Distance(trash.transform.position, player.FeetPosition) < radius) { PickupItem_Networked pickup = trash.GetComponentInParent <PickupItem_Networked>(); PickupObjectManager.RemovePickupItemNetwork(pickup, SteamUser.GetSteamID()); } } catch { } } break; case "command": RConsole console = Traverse.Create(typeof(RConsole)).Field("ConsoleInstance").GetValue() as RConsole; console.sendCommand(string.Join(" ", reward.args)); break; case "meteor_shower": int meteorsToSpawn = 1; if (reward.args.Length > 0) { int.TryParse(reward.args[0], out meteorsToSpawn); } int spawnRadius = 1; if (reward.args.Length > 1) { int.TryParse(reward.args[1], out spawnRadius); } int meteorDamage = 1; if (reward.args.Length > 2) { int.TryParse(reward.args[2], out meteorDamage); } if (stoneDropPrefab == null) { AI_NetworkBehaviour_StoneBird ainbsb = (AI_NetworkBehaviour_StoneBird)nhe.CreateAINetworkBehaviour(AI_NetworkBehaviourType.StoneBird, player.FeetPosition, 0, SaveAndLoad.GetUniqueObjectIndex(), SaveAndLoad.GetUniqueObjectIndex(), null); stoneDropPrefab = Traverse.Create(ainbsb.stateMachineStoneBird.dropStoneState).Field("stoneDropPrefab").GetValue() as StoneDrop; ainbsb.Kill(); } for (int i = 0; i < meteorsToSpawn; i++) { Vector3 dropPosition = player.FeetPosition + new Vector3(UnityEngine.Random.Range(-spawnRadius, spawnRadius), 200, UnityEngine.Random.Range(-spawnRadius, spawnRadius)); meteors.Add(new Meteor(dropPosition, meteorDamage)); } break; case "push_raft": float pushForce; float.TryParse(reward.args[0], out pushForce); body.AddForce(getBoundedRandVector(0.5f, 1) * pushForce, ForceMode.Impulse); break; case "rotate_raft": float rotationForce; float.TryParse(reward.args[0], out rotationForce); body.AddTorque(new Vector3(0, rotationForce, 0), ForceMode.Impulse); break; } } for (int i = statsEdited.Count - 1; i >= 0; i--) { StatData data = statsEdited[i]; if ((currentTime - data.timeStarted).TotalMilliseconds > data.duration) { setStatVal(player, data.stat, data.originalValue); statsEdited.RemoveAt(i); chat.SendChatMessage(data.stat + " back to normal!", SteamUser.GetSteamID()); } } for (int i = tempEntities.Count - 1; i >= 0; i--) { TempEntity ent = tempEntities[i]; if ((currentTime - ent.spawned).TotalMilliseconds > ent.duration) { if (ent.ent != null) { Network_Entity entity = ent.ent.networkEntity; entity.Button_Kill(); AI_StateMachine stateMachine = ent.ent.GetComponent <AI_StateMachine>(); if (stateMachine is AI_StateMachine_Animal) { Traverse.Create((stateMachine as AI_StateMachine_Animal).deadState).Method("RemoveBody").GetValue(); } } tempEntities.RemoveAt(i); } } if (meteors.Count > 0) { meteorDelay--; if (meteorDelay <= 0) { meteorDelay = meteorDelayTot; StoneDrop stone = Instantiate(stoneDropPrefab, meteors.ElementAt(0).pos, Quaternion.identity); float scale = UnityEngine.Random.Range(0.5f, 4f); stone.rigidBody.transform.localScale = new Vector3(scale, scale, scale); stone.rigidBody.AddForce(Vector3.down * meteors.ElementAt(0).damage, ForceMode.Impulse); meteors.RemoveAt(0); } } if (Input.GetKeyDown(KeyCode.Keypad1)) { //Item_Base item = ItemManager.GetItemByName("Watermelon"); //Helper.DropItem(new ItemInstance(item, 10, item.MaxUses), player.transform.position, player.CameraTransform.forward, player.transform.ParentedToRaft()); } else if (Input.GetKeyDown(KeyCode.Keypad2)) { } if (push) { player.PersonController.controller.SimpleMove(pushData.push); if ((currentTime - pushData.startTime).TotalMilliseconds > pushData.duration) { pushData.left--; if (pushData.left == 0) { push = false; } else { pushData.startTime = currentTime; pushData.push = getBoundedRandVector(3, 5); } } } }