コード例 #1
0
        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;
                    }
                }
            }
        }
コード例 #2
0
ファイル: Projectile.cs プロジェクト: xvanick1/CRYENGINE-1
 void OnCollide(CollisionListener.CollisionEvent arg)
 {
     Collide?.Invoke(this, arg);
     collisionListener.OnCollide -= OnCollide;
     timeToLiveTimer.Destroy();
     Destroy();
 }
コード例 #3
0
        public void addCollide(int id, Rectangle hb, bool platform)
        {
            Collide temp = new Collide(id, hb, platform);

            collides.Add(id, temp);
            entities[id].isCollide = true;
        }
コード例 #4
0
 void Start()
 {
     c = FindObjectOfType <Collide>(); //initializes the collide instance.
     //InvokeRepeating("SpawnObject", 2, 2);
     s = FindObjectOfType <SoundManager>();
     //DontDestroyOnLoad(prefabInstance);
 }
コード例 #5
0
 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)]));
 }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
    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;
        }
    }
コード例 #9
0
 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]);
 }
コード例 #10
0
 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]);
 }
コード例 #11
0
 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]);
 }
コード例 #12
0
 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]);
 }
コード例 #13
0
 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]);
 }
コード例 #14
0
 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]);
 }
コード例 #15
0
 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]);
 }
コード例 #16
0
 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]);
 }
コード例 #17
0
        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;
                        }
                    }
                }
            }
        }
コード例 #18
0
    new bool detect()
    {
        Collider2D[] tar = Collide.AreaGetCollideByTag(this.locPos, this.detectRadius, Collide.Method.Circle, "Player");

        if (tar.Length != 0)
        {
            return(true);
        }
        return(false);
    }
コード例 #19
0
        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]));
        }
コード例 #20
0
        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));
        }
コード例 #21
0
    // 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);
    }
コード例 #22
0
        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));
        }
コード例 #23
0
    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);
    }
コード例 #24
0
ファイル: PlayerInteractor.cs プロジェクト: aaronlws95/twog
 public bool Check(Entity other)
 {
     if (MInput.Keyboard.Pressed(Keys.Space))
     {
         return(Collide.Check(other, this));
     }
     else
     {
         return(false);
     }
 }
コード例 #25
0
        public virtual bool LaserBlockingCheck(Laserbeam beam)
        {
            Collider origCollider = Collider;

            Collider = GetLaserBlockingCollider(beam);

            bool colliding = Collide.Check(beam, this);

            Collider = origCollider;

            return(colliding);
        }
コード例 #26
0
 private void OnTransitionOutBegin()
 {
     if (Collide.CheckRect(this, SceneAs <Level>().Bounds))
     {
         transitionFade       = true;
         transitionStartAlpha = tiles.Alpha;
     }
     else
     {
         transitionFade = false;
     }
 }
コード例 #27
0
        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);
        }
コード例 #28
0
        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>);
        }
コード例 #29
0
        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;
            }
        }
コード例 #30
0
        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;
        }
コード例 #31
0
ファイル: test-201.cs プロジェクト: nobled/mono
		public Nested ()
		{
			Test = Collide.Die;
		}
コード例 #32
0
ファイル: Game1.cs プロジェクト: Annihilator81/Dynasty
 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();
 }