private void OnTransitionInBegin() { Level level = SceneAs <Level>(); if (MasterOfGroup) { Player player = null; foreach (CaveWall entity in Group) { if (level.PreviousBounds.HasValue && Collide.CheckRect(entity, level.PreviousBounds.Value)) { entity.transitionFade = true; entity.tiles.Alpha = 0f; } else { entity.transitionFade = false; } player = entity.CollideFirst <Player>(); if (player != null) { break; } } if (player != null) { foreach (CaveWall entity in Group) { entity.transitionFade = false; entity.tiles.Alpha = 0f; } } } }
void OnCollide(CollisionListener.CollisionEvent arg) { Collide?.Invoke(this, arg); collisionListener.OnCollide -= OnCollide; timeToLiveTimer.Destroy(); Destroy(); }
public void addCollide(int id, Rectangle hb, bool platform) { Collide temp = new Collide(id, hb, platform); collides.Add(id, temp); entities[id].isCollide = true; }
void Start() { c = FindObjectOfType <Collide>(); //initializes the collide instance. //InvokeRepeating("SpawnObject", 2, 2); s = FindObjectOfType <SoundManager>(); //DontDestroyOnLoad(prefabInstance); }
private bool collideOrOffscreenCheck(Level level, Glider jellyfish) { return(jellyfish.Position.X + jellyfish.Collider.Right > level.Bounds.Right || jellyfish.Position.X + jellyfish.Collider.Left < level.Bounds.Left || jellyfish.Position.Y + jellyfish.Collider.Top < level.Bounds.Top || Collide.Check(jellyfish, level.Tracker.Entities[typeof(Solid)])); }
public override void Update() { base.Update(); var actors = Scene.Tracker.GetEntities <Actor>(); _currentButtonState = false; foreach (var actor in actors) { if (Collide.Check(actor, _button)) { _currentButtonState = true; break; } } if (_currentButtonState != _previousButtonState) { SendOutSignals(_currentButtonState); } int target = _currentButtonState ? 2 : -2; _button.Image.Position.Y = Calc.Approach(_button.Image.Position.Y, target, 40f * Engine.DeltaTime); _previousButtonState = _currentButtonState; }
public void addCollide(int id, Rectangle hb, bool enemy, bool shackle, int shackled, bool damageable) { Collide temp = new Collide(id, hb, enemy, shackle, shackled, damageable); collides.Add(id, temp); entities[id].isCollide = true; }
private void OnTriggerEnter2D(Collider2D other) { Collide collision = new Collide(); collision.box = other.name; collision.dir = lastBtn; Collisions.Add(collision); switch (lastBtn) { case 1: bUp = false; break; case 2: bDown = false; break; case 3: bLeft = false; break; case 4: bRight = false; break; default: break; } }
public void bottomMidAt20Go2() { ball.Margin = new Thickness(125, 0, 0, 95); acc[0] = 2; acc[1] = 20; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(340, acc[1]); }
public void topRightAt200Go2() { ball.Margin = new Thickness(150, 0, 0, 120); acc[0] = 2; acc[1] = 200; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(160, acc[1]); }
public void topLeftAt290Go2() { ball.Margin = new Thickness(95, 0, 0, 120); acc[0] = 2; acc[1] = 290; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(250, acc[1]); }
public void bottomRightAt160Go2() { ball.Margin = new Thickness(150, 0, 0, 95); acc[0] = 2; acc[1] = 160; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(290, acc[1]); }
public void bottomLeftAt45Go2() { ball.Margin = new Thickness(95, 0, 0, 95); acc[0] = 2; acc[1] = 45; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(225, acc[1]); }
public void topMidAt340Go2() { ball.Margin = new Thickness(125, 0, 0, 120); acc[0] = 2; acc[1] = 340; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(20, acc[1]); }
public void rightMidAt250Go2() { ball.Margin = new Thickness(150, 0, 0, 110); acc[0] = 2; acc[1] = 250; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(290, acc[1]); }
public void leftMidAt70Go2() { ball.Margin = new Thickness(95, 0, 0, 110); acc[0] = 2; acc[1] = 70; Assert.IsTrue(Collide.hit(ball, acc, brick)); Assert.AreEqual(110, acc[1]); }
public override void Update() { base.Update(); CrystalStaticSpinner murderSpinner = null; if (killCircle == null && CollideCheckConnections(ref murderSpinner)) { if (ActiveCompanion != null) { ActiveCompanion.DetachFromPlayer(); } StartKillCircle(murderSpinner); } connectionLineOffset += Engine.DeltaTime * connectionLineSpeed; if (connectionLineOffset > Math.PI * 2.0f) { connectionLineOffset -= (float)Math.PI * 2.0f; } if (killCircle != null) { if (Scene.OnInterval(0.05f)) { foreach (Companion companion in nearestCompanions) { if (manualResets.Contains(companion)) { continue; } float dir = Calc.Random.NextFloat((float)Math.PI * 2f); Vector2 towardsCompanion = (companion.Position - killCircle.Position).SafeNormalize() * (killCircle.Collider as Circle).Radius; SceneAs <Level>().ParticlesFG.Emit(requiresDash ? P_Burst : P_BurstNoDash, 1, killCircle.Position + towardsCompanion, Vector2.Zero, dir); } } (killCircle.Collider as Circle).Radius += killCircleExpansionSpeed * Engine.DeltaTime; foreach (Companion companion in nearestCompanions) { if (!manualResets.Contains(companion) && Collide.Check(companion, killCircle)) { companion.Reset(true); if (manualResets.Count == nearestCompanions.Length) { killCircle.RemoveSelf(); killCircle = null; ResetCompanions(); break; } } } } }
new bool detect() { Collider2D[] tar = Collide.AreaGetCollideByTag(this.locPos, this.detectRadius, Collide.Method.Circle, "Player"); if (tar.Length != 0) { return(true); } return(false); }
public Entity CollideFirst(int tag) { #if DEBUG if (Scene == null) { throw new Exception("Can't collide check an Entity against tracked Entites when it is not a member of Scene"); } #endif return(Collide.First(this, Scene[tag])); }
public List <Entity> CollideAll(int tag, Vector2 at) { #if DEBUG if (Scene == null) { throw new Exception("Can't collide check an Entity against tracked Entites when it is not a member of Scene"); } #endif return(Collide.All(this, Scene[tag], at)); }
// return whether player touch this teleporter new bool detect() { tar = Collide.AreaGetCollideByTag(this.transform.position, this.detectRadius, Collide.Method.Circle, "Player"); if (tar.Length != 0) { return(true); } return(false); }
public bool CollideCheck(int tag, Vector2 at) { #if DEBUG if (Scene == null) { throw new Exception("Can't collide check an Entity against a tag list when it is not a member of Scene"); } #endif return(Collide.Check(this, Scene[tag], at)); }
bool OnEnter() { float d_r = GetComponent <SpriteRenderer>().bounds.size.magnitude; this.hitEnemy = Collide.RayGetCollideByTag(transform.position, d_r, dir, "enemy"); this.hitPlayer = Collide.RayGetCollideByTag(transform.position, d_r, dir, "player"); this.hitBuilding = Collide.RayGetCollideByTag(transform.position, d_r, dir, "building"); //TODO: impove return method return(this.hitEnemy.Length != 0 || this.hitBuilding.Length != 0 || this.hitPlayer.Length != 0); }
public bool Check(Entity other) { if (MInput.Keyboard.Pressed(Keys.Space)) { return(Collide.Check(other, this)); } else { return(false); } }
public virtual bool LaserBlockingCheck(Laserbeam beam) { Collider origCollider = Collider; Collider = GetLaserBlockingCollider(beam); bool colliding = Collide.Check(beam, this); Collider = origCollider; return(colliding); }
private void OnTransitionOutBegin() { if (Collide.CheckRect(this, SceneAs <Level>().Bounds)) { transitionFade = true; transitionStartAlpha = tiles.Alpha; } else { transitionFade = false; } }
public T CollideFirst <T>() where T : Entity { #if DEBUG if (Scene == null) { throw new Exception("Can't collide check an Entity against tracked Entites when it is not a member of Scene"); } else if (Scene.Tracker.Entities.ContainsKey(typeof(T)) == false) { throw new Exception("Can't collide check an Entity against an untracked Entity type"); } #endif return(Collide.First(this, Scene.Tracker.Entities[typeof(T)]) as T); }
public List <T> CollideAll <T>(Vector2 at) where T : Entity { #if DEBUG if (Scene == null) { throw new Exception("Can't collide check an Entity against tracked Entites when it is not a member of Scene"); } else if (Scene.Tracker.Entities.ContainsKey(typeof(T)) == false) { throw new Exception("Can't collide check an Entity against an untracked Entity type"); } #endif return(Collide.All(this, Scene.Tracker.Entities[typeof(T)], at) as List <T>); }
private void OnTransitionInBegin() { Level level = SceneAs <Level>(); if (level.PreviousBounds.HasValue && Collide.CheckRect(this, level.PreviousBounds.Value)) { transitionFade = true; tiles.Alpha = 0f; } else { transitionFade = false; } }
public override void Process(Entity entity) { Collide collide = entity.GetComponent <Collide>(); Player player = entity.GetComponent <Player>(); SpriteComponent sprite = entity.GetComponent <SpriteComponent>(); if (collide == null || player == null || sprite == null) { return; } entity.RemoveComponent <Collide>(); sprite.Sprite.Width *= 1.01f; sprite.Sprite.Height *= 1.01f; }
public Nested () { Test = Collide.Die; }
protected override void Initialize() { // TODO: Add your initialization logic here win = this.Window; // récupérer le handle de la fenetre IsMouseVisible = true; // activer la souris WindowWidth = GraphicsDevice.Viewport.Width; WindowHeight = GraphicsDevice.Viewport.Height; joueur = new Joueur("Pierre", 12, 100, 3, 250, 250); collide = new Collide(); controller = new Controller(); base.Initialize(); }