public void kill(DeathCause p_cause, float p_deathClock = 0.0f) { if (!m_dying) { //ScoreSystem.add(m_score); SCORE m_deathClock = p_deathClock; m_deathClockStart = p_deathClock; m_totalCurrent--; m_firstBlood = true; if (p_cause != DeathCause.SMASHED) { if (p_cause != DeathCause.ZAPPED) { if (m_bloodFx) { Instantiate(m_bloodFx, transform.position + Vector3.up * collider2D.bounds.extents.y * 0.5f, Quaternion.identity); } } else { if (m_bloodFxZap) { Instantiate(m_bloodFxZap, transform.position + Vector3.up * collider2D.bounds.extents.y * 0.5f, Quaternion.identity); } } } m_dying = true; } }
public void GetHitted(DeathCause deathCause) { if (onPlayerHitted != null) { onPlayerHitted(); } if (deathCause == DeathCause.falling) { isHitted = true; FallingVisuals(); StartCoroutine(DieLogicFalling()); } else if (deathCause == DeathCause.spikes) { isHitted = true; SpikeVisuals(); playerBase.FreezePlayer(); StartCoroutine(DieLogicStandard()); } else if (deathCause == DeathCause.gordeldier) { isHitted = true; GordeldierVisuals(); playerBase.FreezePlayer(); StartCoroutine(DieLogicStandard()); } }
public static void KillPlayer(GameObject player, DeathCause cause) { GameObject particleDummyPrefab = (GameObject)(Resources.Load ("Prefabs/ParticleDummy", typeof(GameObject))); GameObject particleDummy = GameObject.Instantiate (particleDummyPrefab); particleDummy.transform.position = player.transform.position; ParticleSystem playPart = particleDummy.GetComponent<ParticleSystem> (); //playPart.Emit (50); PlayerDeathController playerDeath = player.GetComponent<PlayerDeathController>(); if (cause.Equals (DeathCause.OutOfView)) { FollowObject fo = particleDummy.AddComponent<FollowObject>(); particleDummy.GetComponent<SelfDestruct>().waitForCenter = true; fo.followY = false; fo.SetTarget(Camera.main.gameObject); //fo.offsets = (particleDummy.transform.position * 0.75f) - Camera.main.transform.position; } // If necessary, reassign the camera if (player.GetComponent<ViewportControlManagementScript>() != null) { ViewportControlManagementScript viewportManager = player.GetComponent<ViewportControlManagementScript>(); if(viewportManager.HasCamera()) { viewportManager.DestroyViewportTargetIcon(); RandomPlayerCameraReassign(player); } } if (deathSoundSource != null) { deathSoundSource.Play(); } player.SetActive(false); PlayerDeath(player.GetComponent<PlayerControls>().playerNum, cause); }
public void Kill(DeathCause cause, float time) { if (_exploded) { return; } AddPositionToRenderer(_rigidbody.position); _exploded = true; enabled = false; _trailRenderer.enabled = false; _renderer.enabled = false; _rigidbody.detectCollisions = false; _rigidbody.velocity = Vector3.zero; for (int i = 0; i < _data.subweapons.Count; i++) { SubweaponData subweapon = _data.subweapons[i]; if (_subweaponCreated[i] == false && ( (subweapon.activation.onContact && cause == DeathCause.Contact) || (subweapon.activation.onTimeout && cause == DeathCause.Timeout))) { AddSubweapon(subweapon, time, i); } } if (_activeSubweaponCount == 0) { Retire(); } }
public static void SendDeathMessage(Player.Player from, DeathCause cause) { if (!from.Ship.IsDestroyed) { //universe var rdl = new Rdl(); rdl.AddTRA(0x19198C00, 0xFFFFFFFF); rdl.AddText(from.Name + " died. Type: " + cause); var rdlSystem = new Rdl(); rdlSystem.AddTRA(0x0062FF01, 0xFFFFFFFF); rdlSystem.AddText(from.Name + " died. Type: " + cause); foreach (var player in from.Runner.Playerlist) { if (player.Value.Player.Settings[@"senddeath"] && player.Value.System != from.Ship.System) { SendChatToPlayer(player.Value.Player, rdl); } if (player.Value.Player.Settings[@"sendsystemdeath"] && player.Value.System == from.Ship.System) { SendChatToPlayer(player.Value.Player, rdlSystem); } } } }
public static void Print(CellTypes[,] GameBoard, int Score, DeathCause cause) { Thread FeuArtifice; gameBoard = GameBoard; Console.ForegroundColor = ConsoleColor.Red; if (cause == DeathCause.HitSelf) { WriteGameBoard(msghitSelf, 8); } else { WriteGameBoard(msghitWall, 8); } Console.ForegroundColor = ConsoleColor.Green; WriteGameBoard(msgScore + Score, 10); Console.ForegroundColor = ConsoleColor.White; WriteGameBoard(msgRestart, 18); FeuArtifice = new Thread(new ThreadStart(ThreadFeu)); FeuArtifice.Start(); }
public void getEaten(FishHunt hunt) { isBusy = true; isDying = true; deathCause = DeathCause.Eaten; deathTime = 1; dyingTimer = 1; }
public CreatureDeathDataPoint(string _sn, uint _gen, uint _cno, uint _cct, float _lfs, DeathCause _cod) { sn = _sn; gen = _gen; cno = _cno; cct = _cct; lfs = _lfs; cod = _cod; }
public CreatureDeathDataPoint(Creature creature, DeathCause causeOfDeath) { sn = creature.speciesName; gen = creature.Generation; cno = creature.childNo; cct = creature.children; lfs = Time.time - creature.birthTime; cod = causeOfDeath; }
public void startDying(ParticleSystem cause) { isBusy = true; deathParticles = cause; isDying = true; deathTime = deathTime * (.5f + Random.value); dyingTimer = deathTime; deathCause = DeathCause.Particle; }
public PlayerDeathEventArgs(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { Player = player; Corpse = corpse; Cause = cause; Position = position; PlayerIndex = playerIndex; KillerIndex = killerIndex; }
public void startFishing(Lure cause) { isBusy = true; lure = cause; isDying = true; deathTime = deathTime * (.5f + Random.value); dyingTimer = deathTime; deathCause = DeathCause.Lure; lure.gameObject.SetActive(true); lure.addTarget(this); lure.Reset(); }
public void Kill(DeathCause deathCause) { this.deathCause = deathCause; state = State.DYING; //dieTime = Time.time + .2f; World.i.Death(); var p = Instantiate(DeathEffect.gameObject); p.transform.position = transform.position; //Destroy(gameObject); Wiggle.gameObject.SetActive(false); }
internal void Die(DeathCause causeOfDeath) { Debug.Log(ID + " has died. Cause: " + causeOfDeath.ToString()); DataCollector.main.DeathWrite(this, causeOfDeath); if (GetComponent <MeatFoodSource>() != null) { GetComponent <MeatFoodSource>().CreatureToMeat(); } else { DieNow(); } }
public override PlayerCorpse Die(DeathCause deathCause, int killerIndex, bool brambled = false, bool laser = false) { if (summonedChaliceGhost) { summonedChaliceGhost.Vanish(); summonedChaliceGhost = null; } if (Level.Session.MatchSettings.Variants.ReturnAsGhosts[this.PlayerIndex] && !this.diedFromPrism) { this.spawningGhost = true; } return(base.Die(deathCause, killerIndex, brambled, laser)); }
public static void PlayerDeath(int playerNum, DeathCause cause) { //Debug.Log ("p" + playerNum.ToString ()); //Debug.Log (Time.fixedTime); PlayerPrefs.SetFloat ("p" + playerNum.ToString() + "TimeActive" , Time.fixedTime - initialTime); int activeNum = 0; foreach (GameObject go in GameObject.FindGameObjectsWithTag("Player")) { if (go.activeInHierarchy){ activeNum++; } } if (activeNum <= 1) { gameOver = true; toEndMenuTimer = waitForEndMenu; } }
/// <summary> /// Kill the ship immediately, playing the death fuse. /// If this is a player then the charfile will be saved and the player /// set to respawn. /// <param name="type"> /// Byte describing the damage type. 0 - environment, 1-gun, /// 2-missile,3-mine,4-collision,5-admin command. /// </param> /// </summary> public void Destroy(DeathCause cause) { Health = 0; IsDestroyed = true; Basedata = RespawnBasedata; Runner.NotifyOnObjDestroy(this); if (player != null) { // TODO: generate death message Chat.Chat.SendDeathMessage(player, cause); player.SaveCharFile(); } else { Runner.DelSimObject(this); } }
public override void Die(DeathCause deathCause) { switch (deathCause) { case DeathCause.Obstacle: if (skinInfo.hitObstacleParticles.Length != 0) { foreach (ParticleAttributes particle in skinInfo.hitObstacleParticles[UnityEngine.Random.Range(0, skinInfo.hitObstacleParticles.Length)].particles) { GameObject particleObj = GameObject.Instantiate(particle.obj, line.transform.position, Quaternion.Euler(Vector3.zero), particlesParent); GameObject.Destroy(particleObj, particle.alive); } } GameController.PlaySound(skinInfo.dieAudio); break; } }
public Lynch( int day, IPlayer victim, DeathCause cause, [CanBeNull] VerdictManager verdicts = null) { Day = day; Victim = victim; VictimName = victim.Name; VictimRole = victim.Role.Name; Cause = cause; Killer = null; LastWill = victim.LastWill; DeathNote = null; Description = ""; Strength = AttackStrength.Lynch; Direct = false; Stoppable = false; For = verdicts?.Voters(Verdict.Guilty) ?? new List <IPlayer>(); Against = verdicts?.Voters(Verdict.Innocent) ?? new List <IPlayer>(); Abstained = verdicts?.Voters(Verdict.Abstain) ?? new List <IPlayer>(); }
// TODO: Abilities limited by threats and death public Death( int day, IPlayer victim, DeathCause cause, string description, IPlayer killer = null, AttackStrength strength = AttackStrength.Base, bool direct = true, bool stoppable = true) { Day = day; Victim = victim; VictimName = victim.Name; VictimRole = victim.Role.Name; Cause = cause; Killer = killer; LastWill = victim.LastWill; DeathNote = killer?.DeathNote; Description = description; Strength = strength; Direct = direct; Stoppable = stoppable; }
public LineDieEventArgs(Line line, DeathCause cause) { this.line = line; this.cause = cause; }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); this.Session.CurrentLevel.Add(activeGhosts[playerIndex] = new PlayerGhost(corpse)); if (killerIndex == playerIndex || killerIndex == -1) { if (this.Session.CurrentLevel.LivingPlayers == 0) { var otherPlayers = TFGame.Players.Select((playing, idx) => playing && idx != playerIndex ? (int?)idx : null).Where(idx => idx != null).ToList(); var randomPlayer = new Random().Choose(otherPlayers).Value; RemoveGhostAndRespawn(randomPlayer); } } else { RemoveGhostAndRespawn(killerIndex, position); } }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); if (killerIndex == playerIndex || killerIndex == -1) { killCountHUDs[playerIndex].Decrease(); base.AddScore(playerIndex, -1); } else if (killerIndex != -1) { killCountHUDs[killerIndex].Increase(); base.AddScore(killerIndex, 1); } int winner = base.Session.GetWinner(); if (this.wasFinalKill && winner == -1) { this.wasFinalKill = false; base.Session.CurrentLevel.Ending = false; base.CancelFinalKill(); this.endDelay.Set(90); } if (!this.wasFinalKill && winner != -1) { base.Session.CurrentLevel.Ending = true; this.wasFinalKill = true; base.FinalKill(corpse, winner); } this.AfterOnPlayerDeath(player); }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); if (killerIndex == playerIndex || killerIndex == -1) { killCountHUDs[playerIndex].Decrease(); base.AddScore(playerIndex, -1); } else if (killerIndex != -1) { killCountHUDs[killerIndex].Increase(); base.AddScore(killerIndex, 1); } int winner = base.Session.GetWinner(); if (this.wasFinalKill && winner == -1) { this.wasFinalKill = false; base.Session.CurrentLevel.Ending = false; base.CancelFinalKill(); this.endDelay.Set(90); } if (!this.wasFinalKill && winner != -1) { base.Session.CurrentLevel.Ending = true; this.wasFinalKill = true; base.FinalKill(corpse, winner); } this.AfterOnPlayerDeath(player); }
public static void Postfix(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { EventController.Instance.PlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { //if(cause == DeathCause.Arrow) && base.Level.Session. //base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); }
public static async void DestroyWithDeathEffects(GameObject destroyedObject, float time = 0, DeathCause deathCause = DeathCause.All) { await Task.Delay((int)(time * 1000)); if (destroyedObject != null) { IDeathEffect[] deathEffect = destroyedObject.GetComponents <IDeathEffect>(); foreach (IDeathEffect effect in deathEffect) { if (effect.AllowedDeathCause == DeathCause.All || effect.AllowedDeathCause == deathCause) { effect.ActivateEffect(); } } Object.Destroy(destroyedObject); } }
public abstract void Die(DeathCause deathCause);
public void Increment(DeathCause deathCause) { deathCauseCount.TryGetValue(deathCause, out var count); deathCauseCount[deathCause] = count + 1; }
public int GetCount(DeathCause deathCause) { deathCauseCount.TryGetValue(deathCause, out var count); return(count); }
public override void OnPlayerDeath(Player player, PlayerCorpse corpse, int playerIndex, DeathCause cause, Vector2 position, int killerIndex) { base.OnPlayerDeath(player, corpse, playerIndex, cause, position, killerIndex); this.Session.CurrentLevel.Add(activeGhosts[playerIndex] = new PlayerGhost(corpse)); if (killerIndex == playerIndex || killerIndex == -1) { if (this.Session.CurrentLevel.LivingPlayers == 0) { var otherPlayers = TFGame.Players.Select((playing, idx) => playing && idx != playerIndex ? (int?)idx : null).Where(idx => idx != null).ToList(); var randomPlayer = new Random().Choose(otherPlayers).Value; RemoveGhostAndRespawn(randomPlayer); } } else { RemoveGhostAndRespawn(killerIndex, position); } }
/// <summary> /// called by \ref Manager to move us forward a cycle /// </summary> public void Update() { if (IsAlive) { Generations += 1; // If we have reached our destination if (Vector2.Distance(this.Position, Destination) < 2.0F) { if (DestinationList.Count > 0) { var result = ( from v in Manager.Instance.Places where Vector2.Distance(this.Position, new Vector2(v.X, v.Y)) < 2.0F select v).FirstOrDefault(); if (result != null) { // Transfer benefits to the agent TransferBenefits(result.Features); } // Set a new destination Destination = (Vector2)DestinationList.Dequeue(); } else { Destination = Manager.Instance.Map.GetRandomLocation(); } } var nearby = this.GetNeighbors(5); Search(nearby.ToList()); // Using Linq : Filter our list down to Agents only var agents = nearby.OfType <Agent>(); var AgentsAlive = agents.Where((agent) => agent.IsAlive); Trade(AgentsAlive); var dead = agents.Where((agent) => !agent.IsAlive); Loot(dead); // Move towards destination if (Destination.X > X) { X += 1; } else if (Destination.Y > Y) { Y += 1; } else if (Destination.X < X) { X -= 1; } else if (Destination.Y < Y) { Y -= 1; } // Consume resources every 48 ticks if (Manager.Instance.Ticks % Constants.CYCLE_FREQUENCY == 0) { calories -= 11; if (calories < 10 && Food > 0) { Seed("Bread", -1); calories += 50; } Seed("Water", -1); } } bool newlyDead = false; if ((Food <= 0 || Water <= 0) && IsAlive) { newlyDead = true; } IsAlive = !(Food <= 0 || Water <= 0); if (Food <= 0) { CauseOfDeath = DeathCause.Starvation; } if (Water <= 0) { CauseOfDeath = DeathCause.Dehydration; } if (newlyDead) { Console.WriteLine($" {Name,-18} has died of " + CauseOfDeath.ToString(), System.Drawing.Color.Yellow); } }
public static PublicNationInfo GetNationInfo(this DotNS api, string nation) { var nvc = new NameValueCollection(); nvc.Add("nation", nation); var resp = Utilities.API(nvc, null, 0, api.UserAgent); string xml = Utilities.StrResp(resp); var nodelist = Utilities.Parse(xml); var nsinfo = new PublicNationInfo(); foreach (XmlNode node in nodelist) { switch (node.Name.ToLower()) { case "name": nsinfo.Name = node.InnerText; break; case "type": nsinfo.Type = node.InnerText; break; case "fullname": nsinfo.FullName = node.InnerText; break; case "motto": nsinfo.Motto = node.InnerText; break; case "category": nsinfo.Category = node.InnerText; break; case "unstatus": nsinfo.WAStatus = node.InnerText; break; case "endorsements": string[] endors = node.InnerText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (endors.Length == 0 && node.InnerText.Length > 1) { endors = new string[1] { node.InnerText }; } nsinfo.Endorsements = endors.ToList(); break; case "issues_answered": nsinfo.IssuesAnswered = long.Parse(node.InnerText); break; case "freedom": if (nsinfo.Freedom == null) { nsinfo.Freedom = new PublicNationStats(); } foreach (XmlNode n in node.ChildNodes) { switch (n.Name.ToLower()) { case "civilrights": nsinfo.Freedom.CivilRights = n.InnerText; break; case "economy": nsinfo.Freedom.Economy = n.InnerText; break; case "politicalfreedom": nsinfo.Freedom.PoliticalFreedom = n.InnerText; break; } } break; case "region": nsinfo.Region = node.InnerText; break; case "population": nsinfo.Population = long.Parse(node.InnerText) * 1000000; break; case "tax": nsinfo.Tax = double.Parse(node.InnerText, CultureInfo.InvariantCulture) / 100; break; case "animal": nsinfo.Animal = node.InnerText; break; case "currency": nsinfo.Currency = node.InnerText; break; case "demonym": nsinfo.Demonym1 = node.InnerText; break; case "demonym2": nsinfo.Demonym2 = node.InnerText; break; case "demonym2plural": nsinfo.Demonym2Plural = node.InnerText; break; case "flag": nsinfo.FlagURL = node.InnerText; break; case "majorindustry": nsinfo.MajorIndustry = node.InnerText; break; case "govtpriority": nsinfo.GovPriority = node.InnerText; break; case "govt": nsinfo.Gov = new Government(); foreach (XmlNode n in node.ChildNodes) { switch (n.Name.ToLower()) { case "administration": nsinfo.Gov.Administration = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "defence": nsinfo.Gov.Defence = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "education": nsinfo.Gov.Education = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "environment": nsinfo.Gov.Environment = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "healthcare": nsinfo.Gov.Healthcare = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "commerce": nsinfo.Gov.Commerce = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "internationalaid": nsinfo.Gov.InternationalAid = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "lawandorder": nsinfo.Gov.LawAndOrder = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "publictransport": nsinfo.Gov.PublicTransport = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "socialequality": nsinfo.Gov.SocialEquality = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "spirituality": nsinfo.Gov.Spirituality = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; case "welfare": nsinfo.Gov.Welfare = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100; break; } } break; case "founded": nsinfo.Founded = node.InnerText; break; case "firstlogin": nsinfo.FirstLogin = long.Parse(node.InnerText, CultureInfo.InvariantCulture); break; case "lastlogin": nsinfo.LastLogin = long.Parse(node.InnerText, CultureInfo.InvariantCulture); break; case "lastactivity": nsinfo.LastActive = node.InnerText; break; case "influence": nsinfo.Influence = node.InnerText; break; case "freedomscores": if (nsinfo.Freedom == null) { nsinfo.Freedom = new PublicNationStats(); } foreach (XmlNode n in node.ChildNodes) { switch (n.Name.ToLower()) { case "civilrights": nsinfo.Freedom.Score_CR = int.Parse(n.InnerText); break; case "economy": nsinfo.Freedom.Score_Eco = int.Parse(n.InnerText); break; case "politicalfreedom": nsinfo.Freedom.Score_PF = int.Parse(n.InnerText); break; } } break; case "publicsector": nsinfo.PublicSector = double.Parse(node.InnerText, CultureInfo.InvariantCulture) / 100; break; case "deaths": nsinfo.Deaths = new List <DeathCause>(); foreach (XmlNode n in node.ChildNodes) { var cause = new DeathCause() { Name = n.Attributes["type"].Value, Percentage = double.Parse(n.InnerText, CultureInfo.InvariantCulture) / 100 }; nsinfo.Deaths.Add(cause); } break; case "leader": nsinfo.Leader = node.InnerText; break; case "capital": nsinfo.Capital = node.InnerText; break; case "religion": nsinfo.Religion = node.InnerText; break; case "factbooks": nsinfo.Factbooks = long.Parse(node.InnerText); break; case "dispatches": nsinfo.Dispatches = long.Parse(node.InnerText); break; case "dbid": nsinfo.ID = long.Parse(node.InnerText); break; } } return(nsinfo); }
public DeathEvent(DeathCause cause) { Cause = cause; }