Ejemplo n.º 1
0
 private void OnTriggerEnter(Collider coll)
 {
     if (coll.gameObject.GetComponent <IMoveble>() != null)
     {
         _enemy        = coll.gameObject.GetComponent <IMoveble>();
         _enemy.Speed += _speedUpValue;
         _isTimerStart = true;
         gameObject.GetComponent <Transform>().position = new Vector3(9999, 0, 0);
         return;
     }
 }
 private bool CheckCoordinates(IMoveble obj, MouseState ms)
 {
     float finalWidth = obj.X + obj.Width;
     float finalHeight = obj.Y + obj.Height;
     if (ms.X >= obj.X && ms.X <= finalWidth && ms.Y >= obj.Y && ms.Y <= finalHeight)
     {
         return false;
     }
     else
     {
         return true;
     }
 }
Ejemplo n.º 3
0
        public bool CollideCheck(IMoveble gameObject)
        {
            BoundRectangle box = gameObject.BoundRect + gameObject.Velocity;

            if ((Right >= box.Left) && (Left <= box.Right))
            {
                if ((Bottom >= box.Top) && (Top <= box.Bottom))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
 public override void CheckCollision(IMoveble gameObject, Vector2 playerInput)
 {
     if (gameObject.IsKnockedBack)
     {
         return;
     }
     if (BoundRectangle.CollideCheck(gameObject))
     {
         if (gameObject.BoundRect.Bottom > BoundRectangle.Bottom)
         {
             return;
         }
         gameObject.Velocity   = new Vector2(gameObject.Velocity.X, gameObject.Velocity.Y);
         gameObject.IsGrounded = true;
     }
 }
Ejemplo n.º 5
0
        public override void CheckCollision(IMoveble gameObject, Vector2 playerInput)
        {
            if (BoundRectangle.CollideCheck(gameObject))
            {
                if ((gameObject.BoundRect.Bottom == BoundRectangle.Top) && (playerInput.Y > 0))
                {
                    gameObject.Velocity = new Vector2(gameObject.Velocity.X, gameObject.Velocity.Y);
                    return;
                }

                if (gameObject.BoundRect.Bottom <= BoundRectangle.Top)
                {
                    if (playerInput.Y <= 0)
                    {
                        gameObject.Velocity   = new Vector2(gameObject.Velocity.X, BoundRectangle.Top - gameObject.BoundRect.Bottom);
                        gameObject.IsGrounded = true;
                    }
                }
            }
        }
        public override void CheckCollision(IMoveble gameObject, Vector2 playerInput)
        {
            if (BoundRectangle.CollideCheck(gameObject))
            {
                if (gameObject.BoundRect.Bottom <= BoundRectangle.Top)
                {
                    gameObject.Velocity   = new Vector2(gameObject.Velocity.X, BoundRectangle.Top - gameObject.BoundRect.Bottom);
                    gameObject.IsGrounded = true;
                }
                else if (gameObject.BoundRect.Top >= BoundRectangle.Bottom)
                {
                    gameObject.Velocity = new Vector2(gameObject.Velocity.X, BoundRectangle.Bottom - gameObject.BoundRect.Top);
                }

                if (gameObject.BoundRect.Right <= BoundRectangle.Left)
                {
                    gameObject.Velocity = new Vector2(BoundRectangle.Left - gameObject.BoundRect.Right, gameObject.Velocity.Y);
                }
                else if (gameObject.BoundRect.Left >= BoundRectangle.Right)
                {
                    gameObject.Velocity = new Vector2(BoundRectangle.Right - gameObject.BoundRect.Left, gameObject.Velocity.Y);
                }
            }
        }
Ejemplo n.º 7
0
 public void StopMovebleEntity(IMoveble moveble)
 {
     moveble.Move(Vector3.zero);
 }
Ejemplo n.º 8
0
        public void InitMovebleEntity(IMoveble moveble, string id)
        {
            Vector3 vel = VelocityProviderGetter.GetVelocity(id);

            moveble.Move(vel);
        }
Ejemplo n.º 9
0
 public abstract void CheckCollision(IMoveble gameObject, Vector2 playerInput);
        //---------------------------------------------------------------
        //SHIP SYSTEM ENTER
        //---------------------------------------------------------------
        private void ShipSystemEnter(ShipOnMap sender, IMoveble target)
        {
            //Заставлять его нормально считать координаты.
            //И устанавливать IsMoving в фалс.
            foreach (Ship ship in sender.Ships)
            {
                target.ToStarOnMap().SS.Objects.Add(ship);
            }

            sender.OnSystemEnter -= ShipSystemEnter;
            sender.OnRightButtonClick -= ShipOnMapRightButtonClick;

            screens["GalaxyMap"].Objects["Map"].ToMap().Objects.Remove(sender);
        }