⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interfaces.cs

📁 Pocket 1945 is a classic shooter inspired by the classic 1942 game. The game is written in C# target
💻 CS
字号:
using System;
using System.Drawing;

namespace Pocket1945
{
	/// <summary>
	/// This interface is implemented by all game classes
	/// that can be drawn to the screen. The interface has only 
	/// one method passing in a graphics object which the class should 
	/// use to draw itself.
	/// </summary>
	public interface IDrawable
	{
		/// <summary>
		/// Method drawing the game object to the screen.
		/// </summary>
		/// <param name="g">The graphics object used to draw the sprite.</param>
		void Draw(Graphics g);
	}

	/// <summary>
	/// This interface is implementet by all game classes that
	/// are armed. The interface contains methods to check if the item 
	/// can fire a bullet, a method to fire a new bullet, and a method to 
	/// act on a bullet hit.
	/// </summary>
	public interface IArmed
	{
		/// <summary>
		/// Method checking if the game object can fire.
		/// </summary>
		/// <returns>True if the object can fire a new bullet.</returns>
		bool CanFire();

		/// <summary>
		/// Method executing a new bullet hit.
		/// </summary>
		/// <param name="b">The bullet hitting the game object.</param>
		void Hit(Bullet b);

		/// <summary>
		/// Method fiering a new bullet.
		/// </summary>
		/// <returns>Returns a new bullet.</returns>
		Bullet Fire();
	}

	/// <summary>
	/// This interface is implemented by all game objects that you can collide 
	/// into. Examples of collidable objects are the player, the enemies and bonuses.
	/// The method contains one method returning a rectangle defining the collition area.
	/// </summary>
	public interface ICollidable
	{
		/// <summary>
		/// Method returning the collition area of the game object.
		/// </summary>
		/// <returns>A rectangle definging the collition area of the game object.</returns>
		Rectangle GetCollitionRectangle();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -