Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="location"></param>
        /// <param name="side"></param>
        /// <param name="button"></param>
        /// <returns></returns>
        public override bool OnClick(Point location, CardinalPoint side, MouseButtons button)
        {
            // No decoration set
            if (Square.Maze.Decoration == null)
            {
                return(false);
            }

            // No decoration for the alcove
            Alcove alcove = GetAlcove(side);

            if (alcove.Decoration == -1)
            {
                return(false);
            }

            // Point not in decoration
            if (!Square.Maze.Decoration.IsPointInside(alcove.Decoration, location))
            {
                return(false);
            }

            Team team = GameScreen.Team;

            // No item in hand
            if (team.ItemInHand != null)
            {
                if (!alcove.AcceptBigItems && team.ItemInHand.IsBig)
                {
                    return(false);
                }

                // Run scripts
                alcove.AddItem();

                Square.DropItemFromSide(side, team.ItemInHand);
                team.SetItemInHand(null);
            }
            else
            {
                // Run scripts
                alcove.RemoveItem();

                // Set item in hand
                if ((button | MouseButtons.Left) == MouseButtons.Left)
                {
                    team.SetItemInHand(Square.CollectItemFromSide(side));
                }

                // Add to inventory
                else if ((button | MouseButtons.Right) == MouseButtons.Right && team.SelectedHero != null)
                {
                    team.SelectedHero.AddToInventory(Square.CollectItemFromSide(side));
                }
            }


            return(true);
        }
Exemple #2
0
 /// <summary>
 /// Cosntructor
 /// </summary>
 /// <param name="square">Parent square handle</param>
 public AlcoveActor(Square square) : base(square)
 {
     Alcoves = new Alcove[4]
     {
         new Alcove(),
         new Alcove(),
         new Alcove(),
         new Alcove(),
     };
     IsBlocking = true;
 }
		/// <summary>
		/// Cosntructor
		/// </summary>
		/// <param name="square">Parent square handle</param>
		public AlcoveActor(Square square) : base(square)
		{
			Alcoves = new Alcove[4]
			{
				new Alcove(),
				new Alcove(),
				new Alcove(),
				new Alcove(),
			};
			IsBlocking = true;
		}
Exemple #4
0
        /// <summary>
        /// Draws all alcoves according to the view point
        /// </summary>
        /// <param name="batch">Spritebatch handle</param>
        /// <param name="field">Field of view handle</param>
        /// <param name="position">Position in the field of view</param>
        /// <param name="direction">Looking direction</param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            if (field.Maze.Decoration == null)
            {
                return;
            }

            // For each wall side, draws the decoration
            foreach (CardinalPoint side in DisplayCoordinates.DrawingWallSides[(int)position])
            {
                Alcove alcove = GetAlcove(Compass.GetDirectionFromView(direction, side));

                // Get the decoration
                Decoration deco = field.Maze.Decoration.GetDecoration(alcove.Decoration);
                if (deco == null)
                {
                    continue;
                }

                // Draw the decoration
                deco.DrawDecoration(batch, field.Maze.Decoration, position, side == CardinalPoint.South);


                // Hide items
                if (alcove.HideItems || side != CardinalPoint.South)
                {
                    continue;
                }



                // Offset the item locations according to the distance
                Vector2 vect = DisplayCoordinates.GetMonsterScaleFactor(position);
                Point   loc  = deco.PrepareLocation(position);
                loc.Offset((int)(deco.ItemLocation.X * vect.X), (int)(deco.ItemLocation.Y * vect.Y));


                // Draw items in the alcove in front of the team
                foreach (Item item in Square.GetItemsFromSide(direction, side))
                {
                    batch.DrawTile(Square.Maze.Dungeon.ItemTileSet, item.GroundTileID, loc,
                                   DisplayCoordinates.GetDistantColor(position), 0.0f,
                                   DisplayCoordinates.GetItemScaleFactor(position), SpriteEffects.None, 0.0f);
                }
            }
        }