}
//as
//将一个对象转换为指定类的对象(注意不能用它本身来存储as后的结果)
Player p = player as Player;
//配合使用
if(player is Player)
{
//Player p2 = player as Player;
//p2.Attack();
(player as Player).Attack();
}
//遍历判断
foreach(Test temp in m_list)
{
if(temp is Player)
{
(temp as Player).Attack();
}
else if(temp is Monster)
{
(temp as Monster).MonsterAttack();
}
else if(temp is BOSS)
{
(temp as BOSS).BossAttack();
}
}