public void Update() { intervalCount++; if (intervalCount >= interval) { intervalCount = 0; on = !on; } if (on) { for (int i = 0; i < 3; i++) flames.Add(new Flame((int)position.X, (int)position.Y, angle + (float)(r.NextDouble() * 0.7 - 0.35))); } Flame[] flamesCopy = new Flame[flames.Count]; flames.CopyTo(flamesCopy); foreach (Flame f in flamesCopy) { if (f.Update()) flames.Remove(f); } }
public override bool Shoot(PlayerCmd pCmd, float delta) { // spawn particles Flame f = (Flame)_game.World.ParticleManager.SpawnParticle(PARTICLE.FLAMETHROWER, _playerOwner.Head.GlobalTransform, _playerOwner); f.Damage = _damage; return(true); }
private void SpawnFire(Direction d) { Flame childFlame = (Instantiate(flamePrefab, GetSpawnLocation(d), Quaternion.identity, flameAnchor.transform) as GameObject).GetComponent <Flame>(); childFlame.gameObject.name = this.gameObject.name + DirectionToLetter(d); canSpawn[(int)d] = CanSpawnState.CLOSED; childFlame.SetChildProperties(d, distanceFromMotherFlame + 1); }
// Update is called once per frame private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("ra")) { Destroy(other); Flame.SetActive(true); playerScript.raFlames = playerScript.raFlames + 1; } }
//▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ private Flame CreateFlame(List <Flame> arr, Sprite[] type, int i, int j) { Flame flame = Instantiate(flamePrefab).GetComponent <Flame>(); flame.Init(i, j, type); flame.gameObject.transform.SetParent(transform); arr.Add(flame); return(flame); }
public void OnTick(Flame flame) { if (!flame.IsPositionGroundValidated || !flame.Active) { return; } if (flame.Extinguished) { // to be sure: stop and remove all children flame.Children.ForEach(e => { e.Extinguished = true; AltEntitySync.RemoveEntity(e); }); AltEntitySync.RemoveEntity(flame); flame.Active = false; return; } // remove inactive flames and execute tick on every child flame.Children.RemoveAll(e => !e.Active); flame.Children.ForEach(e => OnTick(e)); // logical tick only every 5 seconds if (DateTime.Now < flame.LastManagedTick + TimeSpan.FromSeconds(5d)) { return; } flame.LastManagedTick = DateTime.Now; if (_random.Next(0, 100) <= Math.Max(30 + flame.Level, 50)) { flame.Level += 1; } // create children if (flame.Level > 10 && flame.Level % 5 == 0 && _random.Next(0, 100) <= Math.Max(10 - flame.Level, 30)) { var flamesToSpawn = _random.Next(1, Convert.ToInt32(Math.Floor(flame.Level / 7d))); for (var i = 0; i < flamesToSpawn; i++) { var childFlamePos = flame.Position + new Vector3(_random.Next(0, 50) / 10f, _random.Next(0, 50) / 10f, 0); var childFlame = new FlameBuilder().SetPosition(childFlamePos).InitializeFlame(); flame.Children.Add(childFlame); Console.WriteLine($"Flame {flame.Id} generated child {childFlame.Id}"); } } }
public void CreateFlame() { Vector3 flameSpawnPos = new Vector3(transform.position.x, transform.position.y, transform.position.z); Quaternion rot = Quaternion.Euler(0, 0, 0); Flame newFlame = Instantiate(flamePrefab, flameSpawnPos, rot); newFlame.Initialize(team); newFlame.transform.Rotate(-90, 0, 0); NetworkServer.Spawn(newFlame.gameObject); }
public void Destroy() { foreach (BattleUnitModel unit in BattleObjectManager.instance.GetAliveList()) { if (unit.bufListDetail.GetActivatedBufList().Find(x => x is BattleUnitBuf_Emotion_Fruischutz_Flame) is BattleUnitBuf_Emotion_Fruischutz_Flame Flame) { Flame.Destroy(); } } }
public void Shoot() { if (Time.time > nextShotTime) { nextShotTime = Time.time + msBetweenShots / 1000; Flame newProjectile = Instantiate(projectile, muzzle.position, muzzle.rotation) as Flame; Flame newProjectile2 = Instantiate(projectile, muzzle.position, muzzle.rotation) as Flame; newProjectile.setSpeed(muzzleVelocity); newProjectile2.setSpeed(muzzleVelocity); } }
private void Window_Initialized(object sender, EventArgs e) { Opacity = 0; DoubleAnimation fadein = new() { Duration = TimeSpan.FromSeconds(0.5), From = 0, To = 1 }; BeginAnimation(OpacityProperty, fadein); IEasingFunction se = new SineEase(); ((SineEase)se).EasingMode = EasingMode.EaseInOut; ThicknessAnimationUsingKeyFrames horz = new() { Duration = TimeSpan.FromSeconds(3), RepeatBehavior = RepeatBehavior.Forever, AutoReverse = true }; horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, -3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, 0, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, -3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, 3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, -3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(-3, 0, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(3, 3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, -3, 0, 0), KeyTime.Uniform, se)); horz.KeyFrames.Add(new EasingThicknessKeyFrame(new(0, 0, 0, 0), KeyTime.Uniform, se)); Ship.BeginAnimation(MarginProperty, horz); DoubleAnimationUsingKeyFrames flicker = new() { Duration = TimeSpan.FromSeconds(0.3), RepeatBehavior = RepeatBehavior.Forever, AutoReverse = true }; flicker.KeyFrames.Add(new EasingDoubleKeyFrame(0.3)); flicker.KeyFrames.Add(new EasingDoubleKeyFrame(0)); Flame.BeginAnimation(OpacityProperty, flicker); } private void Website_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { e.Handled = true; Process.Start("OpenWith.exe", Site); } private void Window_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { Close(); }
public void RemoveFlame(Flame flame) { if (flameList.Contains(flame)) { flameList.Remove(flame); if (isHot && coalList.Count == 0 && flameList.Count == 0 && !infiniteFlames) { isHot = false; } UpdateValue(); } }
public override AGameObject[] CreateBullets(Vector2 direction) { var step = Owner.ShootVector * Constants.FLAME_RADIUS / 2; // / Constants.FLAME_BULLETS_COUNT; var bullets = new AGameObject[Constants.FLAME_BULLETS_COUNT]; for (var i = 0; i < Constants.FLAME_BULLETS_COUNT; i++) { var bulletCoordinates = Owner.Coordinates + i * step; bullets[i] = new Flame(Owner, Guid.NewGuid(), direction, bulletCoordinates); } return(bullets); }
public void OnHotChange(Flame endPlank) { if (endPlank.Equals(TearPlankEnd1)) { particles1.SetActive(value: true); TearPlankEnd2.gameObject.SetActive(value: false); } else { particles2.SetActive(value: true); TearPlankEnd1.gameObject.SetActive(value: false); } }
public void AdjustFlame(int node, int level) { Flame f = flame[nextflame++]; f.killchance = level == 0 ? centerKillChance : (level == 1 ? innerKillChance : outerKillChance); NavCoord nav = maze.nodes[node]; Vector3 v = (nav.pos - (node == 0 ? new Vector2(3, 3) : nav.n2.pos)).normalized; bool vertical = v.y == 0; float scale = level == 0 ? flameScale : (level == 1 ? innerFlameScale : outerFlameScale); f.trans.localScale = new Vector3(vertical ? flameScale : scale, vertical ? scale : flameScale, 0); f.trans.localPosition = nav.pos; f.parent.SetActive(false); }
private async void FlamesAtInterval(Flame flame, int wait) { await Task.Factory.StartNew(() => { var xy = flame.GetCords(); context.flames.Add(flame); Thread.Sleep(wait); context.flames.RemoveAll(z => z.GetCords().X == xy.X && z.GetCords().Y == xy.Y); context.RemoveGameObject(flame, xy.X, xy.Y); context.UpdateRequired = true; }); }
public void OnTriggerExit(Collider other) { Coal component = other.gameObject.GetComponent <Coal>(); if (component != null) { boiler.RemoveCoal(component); } Flame component2 = other.gameObject.GetComponent <Flame>(); if (component2 != null) { boiler.RemoveFlame(component2); } }
public void AddFlame(Flame flame) { if (!flameList.Contains(flame)) { flameList.Add(flame); if (flame.isHot.value > 0.5f && !isHot) { Ignite(); } else if (flame.isHot.value < 0.5f && isHot) { flame.Ignite(); } } }
private void OnEnter(GameObject other) { Flame component = other.GetComponent <Flame>(); if (component != null) { heat.SetValue(heat.value + component.isHot.value); } Flammable component2 = other.GetComponent <Flammable>(); if ((bool)component2) { heat.SetValue(heat.value + component2.output.value); } }
public void OnTriggerEnter(Collider other) { if (showDebug) { Debug.Log(base.name + " Entered Range " + other.name); } FlammableScriptHeatSource1 component = other.gameObject.GetComponent <FlammableScriptHeatSource1>(); if ((bool)component) { if (showDebug) { Debug.Log(base.name + " Pass on the Heat "); } component.Ignite(); } FlammableScriptHeatColourChange1 component2 = other.gameObject.GetComponent <FlammableScriptHeatColourChange1>(); if (component2 != null && ignited) { if (showDebug) { Debug.Log(base.name + " The other thing here is supposed to change colour"); } component2.Ignite(); } Flammable component3 = other.gameObject.GetComponent <Flammable>(); if ((bool)component3) { if (showDebug) { Debug.Log(base.name + " The other thing is flammable , its supposed to get hot "); } component3.heat = 1f; } Flame component4 = other.gameObject.GetComponent <Flame>(); if ((bool)component4) { if (showDebug) { Debug.Log(base.name + " The other thing is flammable , its supposed to get hot "); } component4.Ignite(); } }
public void AddFlame(Flame flame) { if (showDebug) { Debug.Log(base.name + " Add Flame "); } if (!flameList.Contains(flame)) { flameList.Add(flame); if (flame.isHot.value > 0.5f && !isHot) { Ignite(); } else if (flame.isHot.value < 0.5f && isHot) { flame.Ignite(); } } }
private IEnumerator _PlayFlames(float duration) { foreach (ParticleSystem Flame in Flames) { if (!Flame.isPlaying) { Flame.Play(true); } } yield return(new WaitForSeconds(duration)); foreach (ParticleSystem Flame in Flames) { if (Flame.isPlaying) { Flame.Stop(true, ParticleSystemStopBehavior.StopEmitting); } } }
public Flame InitializeFlame() { if (_position == Vector3.Zero) // multithreading issue: race-condition { var ex = new InvalidOperationException("Flame needs a position"); Alt.Log("Exception on FlameBuilder: " + ex.Message); throw ex; } var nearestDistance = float.MaxValue; IPlayer nearestPlayer = null; foreach (var player in Alt.GetAllPlayers()) { var distance = player.Position.Distance(_position); if (distance < nearestDistance) { nearestDistance = distance; nearestPlayer = player; } } if (nearestPlayer == null) { var ex = new InvalidOperationException("Flame could not be created, because no nearest player found"); Alt.Log("Exception on FlameBuilder: " + ex.Message); throw ex; } var flame = new Flame(_position, _isGasFire) { Level = _level }; AltEntitySync.AddEntity(flame); nearestPlayer.Emit("FireFighters:Flame:DeterminePositionGround", flame.Id, flame.Position); return(flame); }
void OnTriggerEnter2D(Collider2D other) { EnemyController collided = other.GetComponent <EnemyController>(); if (collided != null) { collided.Hit(); } Flame collidedFlame = other.GetComponent <Flame>(); if (collidedFlame != null) { EnemyController enemyController = collidedFlame.gameObject.GetComponentInParent <EnemyController>(); if (enemyController) { enemyController.Hit(); } } Destroy(gameObject); }
/// <summary> /// Apualiohjelma hävittämiseksi ja savun luomiseksi samaan paikaan /// </summary> /// <param name="olio">olio savutetaan</param> /// <param name="useShock">Käytetäänkö shokkiaaltoa</param> /// <param name="kerroin">minkä kokoinen verrattuna olioon</param> private void Liekita(IPhysicsObject olio, bool useShock = false, double kerroin = 10) { Flame liekki = new Flame(pallonKuva2); liekki.MaximumLifetime = TimeSpan.FromSeconds(3); liekki.Position = olio.Position; liekki.MinVelocity = 5; liekki.MaxVelocity = 30; Add(liekki); olio.Destroy(); // liekki.FadeOut(5); Timer timer = new Timer(); timer.Interval = 3; timer.Start(); timer.Timeout += delegate() { liekki.Destroy(); timer.Stop(); }; SoitaAani(liekinAani); }
public void OnTriggerExit(Collider other) { Flame component = other.gameObject.GetComponent <Flame>(); if (component != null) { flammable.RemoveFlame(component); } Flammable component2 = other.gameObject.GetComponent <Flammable>(); if (component2 != null) { component2.RemoveFlammable(flammable); } FlammableExtinguisher component3 = other.gameObject.GetComponent <FlammableExtinguisher>(); if (component3 != null) { flammable.RemoveExtinguisher(component3); } }
private void FireUpdate(bool timeToCheck) { if (timeToCheck && !fire && fireActive && ((Time.time - lastFire) > minimumDelayBetweenFires) && ShouldSpawn(probOfFire)) { DoctorEvents.Instance.InformFire(0); fire = true; // need to have some way of deciding where to instiantiate the fire! Flame flame = (Instantiate(firePrefab) as GameObject).GetComponent <Flame>(); flame.motherFlame = true; } else if (!fireActive && (Time.time - lastFire) >= timeForFistFire) { DoctorEvents.Instance.InformFire(0); fire = true; fireActive = true; // need to have some way of deciding where to instiantiate the fire! Flame flame = (Instantiate(firePrefab) as GameObject).GetComponent <Flame>(); flame.motherFlame = true; } }
public void FlameBlows(Flame flame) { var mapElementType = _positionFinder.GetMapElement(_gameModel.GetMap, flame.X, flame.Y); switch (mapElementType) { case NonPlayableCharacter npc: npc.IsAlive = false; flame.OwnerPlayer.Hit(npc.Value); break; case PlayerDto player: if (player != flame.OwnerPlayer) { flame.OwnerPlayer.Hit(player.Value); } player.GotHit(); break; } _gameModel.GetMap[flame.X, flame.Y] = new MapElementContainer(flame.X, flame.Y, mapElementType); }
public void UpdateThrust(Vector3 Position, Vector3 Direction, Vector3 Up, TimeSpan ElapsedTime, DefaultEnvironment Environment) { if (LastPosition.HasValue && LastDirection.HasValue) { Position -= Vector3.Normalize(Direction) * ThrustBackshift; var count = (Position - LastPosition.Value).Length() / 200 * 3; for (int i = 0; i < count; i++) { var value = (float)(i + Environment.Random.NextDouble()) / (float)count; var flame = new Flame() { Position = Vector3.Hermite(LastPosition.Value, LastDirection.Value, Position, Direction, value) + Environment.RandomPointInUnitSphere() * 0.1f, Up = Up, Direction = -Direction }; flames.Enqueue(flame); } } LastDirection = Direction; LastPosition = Position; }
public Particles SpawnParticle(PARTICLE partType, Transform trans, Player owner) { Flame p = null; Vector3 adjust = new Vector3(0, 0, 0); switch (partType) { case PARTICLE.FLAMETHROWER: p = (Flame)_flamethrowerScene.Instance(); p.PlayerOwner = owner; p.WeaponType = WEAPONTYPE.FLAMETHROWER; adjust = new Vector3(0, 0, -1.5f); break; } _game.World.ParticleManager.AddChild(p); p.Transform = trans; p.Translate(adjust); return(p); }
public void OnTriggerExit(Collider fuel) { Flammable component = fuel.gameObject.GetComponent <Flammable>(); if (component != null) { if (showDebug) { Debug.Log(base.name + " Removing fuel "); } boiler.RemoveFuel(component); } Flame component2 = fuel.gameObject.GetComponent <Flame>(); if (component2 != null) { if (showDebug) { Debug.Log(base.name + " Removing flame "); } boiler.RemoveFlame(component2); } }
public void OnTriggerEnter(Collider boilerFuel) { Flammable component = boilerFuel.gameObject.GetComponent <Flammable>(); if (component != null) { if (showDebug) { Debug.Log(base.name + " Flammable thing hit boiler collision "); } boiler.AddFuel(component); } Flame component2 = boilerFuel.gameObject.GetComponent <Flame>(); if (component2 != null) { if (showDebug) { Debug.Log(base.name + " Flame thing hit boiler collision "); } boiler.AddFlame(component2); } }
public void SpawnFlame() { for (int i = 0; i < _flames.Length; ++i) { if (_flames[i] == null) { _flames[i] = new Flame (); float r = 150.0f; float dx = (float)Math.Cos (Math.PI * Angle / 2048.0); float dy = (float)Math.Sin (Math.PI * Angle / 2048.0); float endX = dx * r; float endY = dy * r; _flames[i]._frame = Util.RandomInt (0, 59); _flames[i]._tick = 0; _flames[i]._startX = X + dx * 8; _flames[i]._startY = Y + dy * 8; _flames[i]._endX = _flames[i]._startX + endX; _flames[i]._endY = _flames[i]._startY + endY; _flames[i]._angle = Angle - 1024; _flames[i]._angle2 = Util.RandomInt (-2048, 2047); break; } } }
/** * */ public void OnFlameEnter(Flame flame) { this.fuseLength = 0f; }
/** * */ public void OnFlameEnter(Flame other) { this.Light(); }