Esempio n. 1
0
        public virtual void OnCollision(Body target, CollisionType collisionType, int bodyIndex)
        {
            if (this.Collision != null)
            {
                BodyEventArgs ev = new BodyEventArgs();
                ev.TargetCollider = target;
                ev.CollisionType  = collisionType;
                ev.BodyIndex      = bodyIndex;

                this.Collision(this, ev);
            }
        }
Esempio n. 2
0
        void Car_Collision(object sender, BodyEventArgs e)
        {
            if (e.TargetCollider is WayPoint)
            {
                WayPoint wp = e.TargetCollider as WayPoint;

                if (wp != CurrentWayPoint)
                {
                    WayPoint aux = wp.GetNextWayPoint(this.CurrentWayPoint, this.HandRule);
                    this.CurrentWayPoint = wp;

                    this.Speedy = aux.SquareCollider.Position - this.SquareCollider.Position;
                    this.Speedy = this.Speedy.GetMultNormal(speedy_const);
                }
            }
        }