這裏界面MOF我的代碼的一部分:問題與XNA遊戲項目
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
.
.
.
public virtual bool CheckCollision(ICollidable i_Source)
{
bool collided = false;
ICollidable2D source = i_Source as 2DICollidable;
if (source != null)
{
collided = source.Bounds.Intersects(this.Bounds);
}
return collided;
}
出於某種原因,有關於使用ICollided2D錯誤。 它爲什麼不識別這種變量?我錯過任何「使用」的說法嗎?
你應該更精確。什麼是你收到的錯誤信息? – Patrik 2011-05-08 09:12:43
你的意思是編譯錯誤? (在嘗試編譯代碼時收到),或實際執行時發生運行時錯誤? – 2011-05-08 13:10:42