public override void OnPlayerTick(SimulationPlayer player) { Entity avatar = player.Avatar; var extension = avatar.GetExtension <MoverExt>(); extension.SetMaximumSpeed(15f); }
public void OnPlayerTick(SimulationPlayer player) { foreach (var target in hooks) { target.OnPlayerTick(player); } }
public static void AvatarDestroyed(SimulationPlayer player) { try { _instance._logger.Debug($"Avatar Destroyed: {player?.Avatar?.name}"); _instance.OnAvatarDestroyed?.Invoke(_instance._game, player); } catch (Exception ex) { _instance._logger.Error(nameof(AvatarDestroyed) + "GAME UPDATED: Error occurred: \r\n" + ex.ToString()); } }
public override void OnPlayerTick(SimulationPlayer player) { //base.OnPlayerTick(player); //GameObject b = new GameObject(); //was testing if we can do this, there was a class inhereting MonoBehavior but now may be un-needed. ///<summary> /* * MonoBehaviour script = b.AddComponent(typeof(MonoBehaviour)) as MonoBehaviour; * script = new GuiBehavior(); * b.SetActive(true); */ /// </summary> /// }
public static void AvatarDestroyed(SimulationPlayer player) { _instance._logger.Debug($"Avatar Destroyed: {player?.Avatar?.name}"); _instance.OnAvatarDestroyed?.Invoke(_instance._game, player); }
public override void OnPlayerTick(SimulationPlayer player) { ScrollCanvas(0.5f); player_ref = player; bool took_hit = false; ///summary /// Try to curse the player every time they take damage Entity avatar = player_ref.Avatar; HealthExt e = avatar.GetExtension <HealthExt>(); MoverExt extension = avatar.GetExtension <MoverExt>(); if (e.CurrentHP < lasthp) { if (!slowed) { float potspeed = extension.MaximumSpeed; if (potspeed > speed) { speed = potspeed; } } int chance = UnityEngine.Random.Range(0, 3); switch (chance) { case 1: e.AddRandomCurse(HealthExt.CurseType.Major, avatar); took_hit = true; break; case 2: if (!slowed) { slowed = true; CreatePlayerPopup("SLOWNESS EFFECT"); slowness_ticks_remaining = slowness_ticks_base; normal_speed = speed; extension.SetMaximumSpeed(normal_speed / 3f); speed = (normal_speed / 3f); } break; } } lasthp = e.CurrentHP; if (e.CurrentHP < 60 && took_hit) { CreatePlayerPopup("It hurts, I can feel my health sapping away!"); } //Unslow the player //And tick if (slowed) { slowness_ticks_remaining -= 1; if (slowness_ticks_remaining <= 0) { slowness_ticks_remaining = 0; slowed = false; extension.SetMaximumSpeed(normal_speed); speed = normal_speed; CreatePlayerPopup("SLOWNESS FADED"); } } int value = UnityEngine.Random.Range(0, 1000); if (player_ref != null) { if (value == 5) { CreatePlayerPopup(postmessages[UnityEngine.Random.Range(0, postmessages.Count - 1)]); } } }