kindle魔鬼的牧师 mobi广告怎么去掉?

魔鬼的牧师_百度百科
魔鬼的牧师
《魔鬼的牧师》是中信出版社出版的图书,作者是理查德·道金斯。
魔鬼的牧师内容简介
★没饭吃的非洲儿童VS濒临灭绝的黑猩猩,你给谁捐款?
★Gay是天生的?“同性恋基因”真的存在吗?
★12个不明真相的围观群众PK 1名法官,真理掌握在多数人手中?
★占星、看风水、通灵、水晶球,这些伪科学,相信你就错了!
1、继达尔文之后最有影响力的生物学家,畅销世界30年颠覆人类世界观的科学圣经《自私的基因》作者,备受比尔·盖茨、梁文道、刘慈欣、俞敏洪、姬十三等人热推的超级畅销书科普作家理查德·道金斯,科学创作25年来唯一自选集,告诉你正确打开科学世界的方式,国内首次出版!
2、基因、克隆、占星、陪审团、创世说、进化论……满满当当的科学干货,结结实实的真知灼见,与我们每一个人都息息相关的生活智慧,不容错过!
3、32篇精彩小品,幽默风趣,通俗易懂,绝对让你脑洞大开、爱不释手的科学入门书!
4、道金斯作品延伸阅读——《自私的基因》《盲眼钟表匠》《地球上最伟大的表演》《解析彩虹》《祖先的故事》《攀登不可能的山峰》
5、“科学可以有诗意。以科学的方式正确理解的真实世界,是绝美的,永远有着无穷的乐趣…… ”
——理查德·道金斯
“魔鬼的牧师”一词,首先由达尔文于1856年提出,指的是“为进化和自然选择辩护,反对上帝创世论,坚决主张无神论的人”。道金斯以此自居,高举科学大旗,倡导无神论,堪称坚定的进化论者。
《魔鬼的牧师》是超级畅销书作家理查德·道金斯科学创作25年来唯一自选集。25年卓越的科学思考,遴选出32篇精彩的科学美文,涉及基因、宗教、道德、教育、公平、正义等重大公共话题,科学与理性兼具,犀利与温情并存,风格亲切幽默,通俗易懂,是一本绝佳的科普经典读物。理查德·道金斯以超凡的科学学识与独特的人生经验,坚决主张从真凭实据中追求科学真理,唤起人们对物理世界永恒的好奇心。
魔鬼的牧师媒体推荐
非常发人深省。
——《纽约时报》书评
作为当代最知名的科学家、作者之一……道金斯对科学的热爱,无愧且波澜壮阔。论及神圣,于他而言,必然是真理和通往真理之路……他是杰出的作者,明智的簇拥者,学识广博而足智多谋的人。
——《新共和国》
道金斯……主张坚定,表述清晰,强劲有力。
——《科学美国人》
极其卓越。……让篇篇文章凝成整体的,也正是使之充满活力的因素:文笔儒雅清晰、内容知性真诚且富有真知和勇气。……作者的书读起来令人愉悦,散文写得优美,而且论点优雅有力。
——《文学评论》
透过字里行间,科学闪烁着光芒化作愉悦的源头。……他的视角清晰,非比寻常。
——《闲暇》
文集作者堪称世界优秀的进化论生物学家。作者笃信从真凭实据中追求科学真理,于文集中探讨所得。
——《科学新闻》
道金斯对地球生物多样性所表现的热情富有感染力。
——《出版人周刊》
通往科学原则的愉悦之旅……被美妙呈现与颂扬。
——《科克斯评论》
大力倡导经验科学而非迷信……即使他如此顽固,却真正唤起了人们对物理世界的好奇心。
——《图书馆杂志》,获评年度最佳科技书籍
魔鬼的牧师作者简介
(Richard Dawkins,1941— ),院士,教授,著名科普作家,进化论生物学家。他是英国最重要的科学作家,几乎每本书都是畅销书,并经常在各大媒体引起轰动。2005年,英国《前景》杂志会同美国《外交政策》杂志评选出在世的全球100名最有影响力的公共知识分子,道金斯赫然在列。1976年出版的《自私的基因》是他最重要的代表作,他的基因观念颠覆了我们对自身的幻觉,深刻影响了整整一个时代。其他作品有《盲眼钟表匠》《地球上最伟大的表演》《魔鬼的牧师》《解析彩虹》《祖先的故事》《攀登不可能的山峰》等。
魔鬼的牧师目录
美版介绍  ------  第一章科学和感性  魔鬼的牧师  什么是真理?  思想的差距  科学、遗传学和伦理学——托尼·布莱尔的备忘录  陪审团的审判  水晶般的真理和水晶球  被脱光的后现代主义  活在危险之中的乐趣——昂德尔公学的桑德森  ------  第二章待现的曙光  待现的曙光  达尔文的胜利  “信息挑战”  基因不等于我们  摩尔定律之子  ------  第三章被感染的思想  中式帆船和传话游戏  思维的病毒  大趋同  克隆羊多莉和缠头巾的人  该站出来了  ------  第四章他们告诉我了,赫拉克利特  痛悼道格拉斯  致道格拉斯·亚当斯的悼词  致W·D·汉密尔顿的悼词  万灵油  ------  第五章就连托斯卡尼的官兵也忍不住欢呼  为多样的大自然而欣喜  可发展的艺术  怪诞虫、威瓦亚虫和朋友们  人类沙文主义和进化的进步  与达尔文主义的巨擘未完成的通信  ------  第六章非洲以及我们身边的非洲天才  基因的生态学  从非洲的灵魂中消失  我赞美非洲和欢乐时光  英雄和祖先  ------  第七章祝福女儿  相信事情的充分理由和糟糕的理由  注释[1]
.豆瓣[引用日期]
企业信用信息古墓魅影全文免费阅读-魔鬼牧师-言情后花园
言情后花园提供在线阅读,努力做最优秀的!
欢迎您访问言情后花园www.yqhhy.cc,如果喜欢请介绍给周边朋友!
第二卷 海岭玄武
七夕特别篇
第八卷 灵犀银河
《古墓魅影》的邻居
完结科幻灵异小说推荐
书友正在看
如果你觉得不错,就请把《古墓魅影》推荐给你的朋友!《古墓魅影》版权归作者所有。如有疑问请联系我们。
言情后花园提供,,,,,,,等作品赏析。努力做最优秀的爱情和其他魔鬼 by [哥伦比亚]加西亚·马尔克斯 mobi,epub,pdf,txt格式Kindle电子书下载 - 读远
爱情和其他魔鬼
爱情和其他魔鬼
豆瓣评分:9.0
上架时间: 10:55
内含马尔克斯的一部中篇、两部短篇小说:《爱情和其他魔鬼》、《没有人给他写信的上校》和《一桩事先张扬的凶杀案》。
读远网关闭电子资源上传下载服务,新读远预计6月中旬上线,敬请期待。
1. 读远是一个纯净的阅读社区,不以盈利为目的。
2. 读远非常鼓励用户购买正版,。
3. 如果网友上传资源侵犯了您的合法权益,请立即。古墓魅影(魔鬼牧师) 最新章节 全文免费阅读 全集txt下载-科幻灵异-武林中文网
& 科幻灵异 & 古墓魅影
推荐阅读:、、、、、、、
《古墓魅影》最新章节
第一卷 冥河宝瓶第二卷 海岭玄武第三卷 神仙笔花第四卷 梦魇都市第五卷 麒麟古城第六卷 七夕特别篇第七卷 麒麟龙脉第八卷 灵犀银河魄瓶之旅
相关小说:、、、、、、、1547人阅读
unity(8)
& & & & 牧师和魔鬼游戏是一款益智类游戏,游戏的目标是将3个牧师和3个魔鬼从河的一端安全地送到河的另一端。在运送过程中,船可以搭载两个人,而且必须有一人掌船。无论何时,只要河一边的魔鬼数量多于牧师的数量,游戏就会以失败结束。想玩玩的话请走传送门:
& & & & 先上个成品草图:
& & & & 游戏需要的对象:
游戏角色:3个牧师、3个魔鬼
游戏场景:2个河岸、1艘小船
& & & & 游戏的架构:
& & & & UserInterface用来创建GUI对象接受玩家动作,处理GUI事件,使用 IUserActions 接口控制游戏。
& & & & SceneController是单实例对象,用来处理对象间通信和实现 IUserActions 接口。
& & & & BaseCode用来保存游戏名称和游戏简介,它注册在 SceneController 中。
& & & & GenGameObject用来创建游戏对象和处理对象运动,它也注册在 SceneController 中。IUserActions 接口通过与 GenGameObject 互动完成游戏逻辑。
& & & & 想看完整的代码请直接跳至结尾~
一、新建一个3d游戏项目,建立 BaseCode 脚本,并挂载到主摄像机。
& & & & 在根目录 Assets 下创建 Scripts 文件夹,在 Scripts 文件夹下创建BaseCode 脚本:
& & & & 在 BaseCode 脚本里面声明一个新的命名空间 Com.Mygame,并把单实例对象 GameSceneController 定义其中。这样的话,其它脚本要使用 GameSceneController 只需要在脚本开头添加 “using Com.Mygame” 就可以使用对象了,同时命名空间也将我们自己的类和系统类分别开来。BaseCode 脚本的代码如下:
using UnityE
using System.C
using Com.M
namespace Com.Mygame {
public class GameSceneController: System.Object {
private static GameSceneController _
private BaseCode _base_
public static GameSceneController GetInstance() {
if (null == _instance) {
_instance = new GameSceneController();
public BaseCode getBaseCode() {
return _base_
internal void setBaseCode(BaseCode bc) {
if (null == _base_code) {
_base_code =
public class BaseCode : MonoBehaviour {
public string gameN
public string gameR
void Start () {
GameSceneController my = GameSceneController.GetInstance();
my.setBaseCode(this);
& & & & 所谓单例类,即是全局中只能存在唯一一个对象的类,通过函数GetInstance()可以获得这个类的实例对象。因为 GameSceneController 单例类直接声明在 Com.Mygame 命名空间里,因此是全局的,在其中注入的对象都可以看作是全局对象,比如 BaseCode 对象。
& & & & 这样做的目的是实现代码的MVC架构,通过在单例类中注入对象可以实现对象间的通信,而无需使用 Find、SendMessage 这类破坏程序结构的通讯耦合语句。
& & & & 我希望用 BaseCode 记录游戏的名字和游戏的简介,因此在 BaseCode 中声明了两个公有变量 gameName、gameRule,它们会被将来的GUI对象获取并显示。
二、新建脚本GenGameObjects,挂载到主摄相机。新建脚本IUserInterface,挂载到一个Empty对象。
三、在 GenGameObjects 中创建长方形、正方形、球及其色彩代表游戏中的对象。并把组件自己注入到 GameSceneController 单例模式对象。
& & & & 先在游戏面板创建游戏对象,在 Assets 文件夹下新建 Resources 文件夹,在 Resources 文件夹下新建 Prefabs 文件夹,然后将创建的对象拖入 Prefabs 中成为预设物体。
& & & & 我假设牧师为球体、魔鬼为正方体、河岸为长方体、船也为长方体:
& & & &&& & & &&
& & & & 设置主摄像机的投影模式为正交投影,调整大小,这样看到的所有物体都是平面的了。
& & & & GenGameObect 部分代码:
public class GenGameObject : MonoBehaviour {
Stack&GameObject& priests_start = new Stack&GameObject&();
Stack&GameObject& priests_end = new Stack&GameObject&();
Stack&GameObject& devils_start = new Stack&GameObject&();
Stack&GameObject& devils_end = new Stack&GameObject&();
GameObject[] boat = new GameObject[2];
GameObject boat_
public float speed = 100f;
GameSceneC
Vector3 shoreStartPos = new Vector3(0, 0, -12);
Vector3 shoreEndPos = new Vector3(0, 0, 12);
Vector3 boatStartPos = new Vector3(0, 0, -4);
Vector3 boatEndPos = new Vector3(0, 0, 4);
float gap = 1.5f;
Vector3 priestStartPos = new Vector3(0, 2.7f, -11f);
Vector3 priestEndPos = new Vector3(0, 2.7f, 8f);
Vector3 devilStartPos = new Vector3(0, 2.7f, -16f);
Vector3 devilEndPos = new Vector3(0, 2.7f, 13f);
& & & & 这部分声明了 GenGameObject &各变量,其中我打算用 Stack 集合类型存储牧师和魔鬼对象,start表示开始岸,end表示目标岸。
& & & & 船需要三个变量,boat是一个对象数组,用来存储船所承载的物体,boat_obj为船的实体。Speed为公有变量(方便更改),代表船行驶的速度。
& & & & My是一个 GameSceneController 对象,之所以需要 GameSceneController,是因为游戏逻辑需要“状态”,这些“状态”为枚举类型,并且保存在 GameSceneController 中。
& & & & 剩下的一系列 Vector3 类型,均表示物理位置,它们会在牧师、魔鬼、河岸、船预设实例化的时候被使用,或者在游戏物体需要移动时使用。
void Start () {
my = GameSceneController.GetInstance();
my.setGenGameObject(this);
loadSrc();
& & & & 这部分代码将 GenGameObject 对象注入了 GameSceneController 单实例对象中。当然,要在GameSceneController中定义该函数:
public GenGameObject getGenGameObject() {
return _gen_game_
internal void setGenGameObject(GenGameObject ggo) {
if (null == _gen_game_obj) {
_gen_game_obj =
& & & &&loadSrc()用来实例化游戏对象:
void loadSrc() {
Instantiate(Resources.Load(&Prefabs/Shore&), shoreStartPos, Quaternion.identity);
Instantiate(Resources.Load(&Prefabs/Shore&), shoreEndPos, Quaternion.identity);
boat_obj = Instantiate(Resources.Load(&Prefabs/Boat&), boatStartPos, Quaternion.identity) as GameO
// priests & devils
for (int i = 0; i & 3; ++i) {
priests_start.Push(Instantiate(Resources.Load(&Prefabs/Priest&)) as GameObject);
devils_start.Push(Instantiate(Resources.Load(&Prefabs/Devil&)) as GameObject);
Instantiate(Resources.Load(&Prefabs/Light&));
& & & & 其中 light 是后来添加上去的,为了让场景中有光亮。注意,只有在 Resources 文件夹下的资源才能使用 Load 加载。
四、用表格列出玩家动作表(规则表)
& & & & 在继续编写 GenGameObject 脚本之前,我们要明确游戏允许玩家的所有动作。这里,我规定的玩家动作有7个:
船在开始岸、船在结束岸
船的左方下船
船靠岸且船左方有人
船的右方下船
船靠岸且船右方有人
开始岸的牧师上船
船在开始岸,船有空位,开始岸有牧师
开始岸的魔鬼上船
船在开始岸,船有空位,开始岸有魔鬼
结束岸的牧师上船
船在结束岸,船有空位,结束岸有牧师
结束岸的魔鬼上船
船在结束岸,船有空位,结束岸有魔鬼
五、基于规则表完善 GenGameObject 类
& & & & 考虑到牧师和魔鬼的位置时刻要根据堆栈的数据变化,因此先定义一个 setCharacterPositions 函数。该函数接受一个stack参数,和一个Vector3坐标。它的作用就是把stack里的object从Vector3坐标开始依次排开:
void setCharacterPositions(Stack&GameObject& stack, Vector3 pos) {
GameObject[] array = stack.ToArray();
for (int i = 0; i & stack.C ++i) {
array[i].transform.position = new Vector3(pos.x, pos.y, pos.z + gap*i);
& & & & 然后在 Update 方法里便可以使用:
void Update() {
setCharacterPositions(priests_start, priestStartPos);
setCharacterPositions(priests_end, priestEndPos);
setCharacterPositions(devils_start, devilStartPos);
setCharacterPositions(devils_end, devilEndPos);
& & & &&现在,我们来考虑规则抽象的行为,分为3种:上船、开船、下船。
1.& 上船:把一个游戏对象设为船的子对象。
& & & & 定义 getOnTheBoat 函数,接受一个游戏对象为参数,只要船上有空位,就把游戏对象设置为船的子对象,这样游戏对象便能跟着船移动:
void getOnTheBoat(GameObject obj) {
if (boatCapacity() != 0) {
obj.transform.parent = boat_obj.
if (boat[0] == null) {
obj.transform.localPosition = new Vector3(0, 1.2f, -0.3f);
obj.transform.localPosition = new Vector3(0, 1.2f, 0.3f);
2.& 开船:根据游戏“状态”,把船从一方移动到另一方。
& & & & 这里,我们讨论到了游戏状态,我们需要游戏状态了解船当前的位置。游戏状态作为枚举类型声明在 BaseCode 脚本中:
public enum State { BSTART, BSEMOVING, BESMOVING, BEND, WIN, LOSE };
* BSTART: boat stops on start shore
* BEND: boat stops on end shore
* BSEMOVING: boat is moving from start shore to end shore
* BESMOVING: boat is moving from end shore to start shore
* LOSE: lose
& & & & 有了游戏状态,只需要定义一个 moveBoat 函数,修改游戏状态为MOVING即可,剩下的动作均在Update函数中完成:
public void moveBoat() {
if (boatCapacity() != 2) {
if (my.state == State.BSTART) {
my.state = State.BSEMOVING;
else if (my.state == State.BEND) {
my.state = State.BESMOVING;
3.& 下船:取消船和游戏对象的父子关系,并且根据游戏“状态”将游戏对象压入stack。
& & & & 定义 getOffTheBoat 函数,接受一个整型变量为参数,该变量可以为0或1:
public void getOffTheBoat(int side) {
if (boat[side] != null) {
boat[side].transform.parent =
if (my.state == State.BEND) {
if (boat[side].tag == &Priest&) {
priests_end.Push(boat[side]);
else if (boat[side].tag == &Devil&) {
devils_end.Push(boat[side]);
else if (my.state == State.BSTART) {
if (boat[side].tag == &Priest&) {
priests_start.Push(boat[side]);
else if (boat[side].tag == &Devil&) {
devils_start.Push(boat[side]);
boat[side] =
& & & & 注意到,为了区分出牧师和魔鬼,我给牧师和魔鬼预设分别添加了Tag。Tag需要在控制面板添加。
& & & & 除此以外,还需要判断游戏的输赢,定义一个 check 函数:
void check() {
int pOnb = 0, dOnb = 0;
int priests_s = 0, devils_s = 0, priests_e = 0, devils_e = 0;
if (priests_end.Count == 3 && devils_end.Count == 3) {
my.state = State.WIN;
for (int i = 0; i & 2; ++i) {
if (boat[i] != null && boat[i].tag == &Priest&) pOnb++;
else if (boat[i] != null && boat[i].tag == &Devil&) dOnb++;
if (my.state == State.BSTART) {
priests_s = priests_start.Count + pO
devils_s = devils_start.Count + dO
priests_e = priests_end.C
devils_e = devils_end.C
else if (my.state == State.BEND) {
priests_s = priests_start.C
devils_s = devils_start.C
priests_e = priests_end.Count + pO
devils_e = devils_end.Count + dO
if ((priests_s != 0 && priests_s & devils_s) || (priests_e != 0 && priests_e & devils_e)) {
my.state = State.LOSE;
& & & & 修改 Update 函数,加入船的移动,游戏结束条件的判断:
void Update() {
setCharacterPositions(priests_start, priestStartPos);
setCharacterPositions(priests_end, priestEndPos);
setCharacterPositions(devils_start, devilStartPos);
setCharacterPositions(devils_end, devilEndPos);
if (my.state == State.BSEMOVING) {
boat_obj.transform.position = Vector3.MoveTowards(boat_obj.transform.position, boatEndPos, speed*Time.deltaTime);
if (boat_obj.transform.position == boatEndPos) {
my.state = State.BEND;
else if (my.state == State.BESMOVING) {
boat_obj.transform.position = Vector3.MoveTowards(boat_obj.transform.position, boatStartPos, speed*Time.deltaTime);
if (boat_obj.transform.position == boatStartPos) {
my.state = State.BSTART;
else check();
& & & & OK,游戏的基本动作已经全部实现了!
& & & & 不过,为了与玩家规则表对应,还需要定义4个函数:
& & & & priestStartOnBoat、priestEndOnBoat、devilStartOnBoat、devilEndOnBoat
& & & & 它们的作用是调用相应的 getOnTheBoat 函数,把玩家指定的对象放到船上:
public void priestStartOnBoat() {
if (priests_start.Count != 0 && boatCapacity() != 0 && my.state == State.BSTART)
getOnTheBoat(priests_start.Pop());
public void priestEndOnBoat() {
if (priests_end.Count != 0 && boatCapacity() != 0 && my.state == State.BEND)
getOnTheBoat(priests_end.Pop());
public void devilStartOnBoat() {
if (devils_start.Count != 0 && boatCapacity() != 0 && my.state == State.BSTART)
getOnTheBoat(devils_start.Pop());
public void devilEndOnBoat() {
if (devils_end.Count != 0 && boatCapacity() != 0 && my.state == State.BEND)
getOnTheBoat(devils_end.Pop());
六、修改 BaseCode 脚本,添加 IUserActions 接口,并在 GameSceneController 中实现。
& & & & 回到 BaseCode 脚本,在命名空间 Com.Mygame 里添加 IUserActions 接口:
public interface IUserActions {
void priestSOnB();
void priestEOnB();
void devilSOnB();
void devilEOnB();
void moveBoat();
void offBoatL();
void offBoatR();
void restart();
& & & & 在 GameSceneController 中添加接口的实现方法:
public void priestSOnB() {
_gen_game_obj.priestStartOnBoat();
public void priestEOnB() {
_gen_game_obj.priestEndOnBoat();
public void devilSOnB() {
_gen_game_obj.devilStartOnBoat();
public void devilEOnB() {
_gen_game_obj.devilEndOnBoat();
public void moveBoat() {
_gen_game_obj.moveBoat();
public void offBoatL() {
_gen_game_obj.getOffTheBoat(0);
public void offBoatR() {
_gen_game_obj.getOffTheBoat(1);
public void restart() {
Application.LoadLevel(Application.loadedLevelName);
state = State.BSTART;
& & & & 注意,多了一个 Restart 方法哦~
七、修改 UserInterface 脚本,创建GUI对象,处理GUI事件。
& & & & 这里就不多讲了,主要是编写OnGUI函数,在合适的位置添加按钮,并且调用按钮所对应的接口函数:
if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), &Go&)) {
action.moveBoat();
if (GUI.Button(new Rect(castw(10.5f), casth(4f), width, height), &On&)) {
action.devilSOnB();
if (GUI.Button(new Rect(castw(4.3f), casth(4f), width, height), &On&)) {
action.priestSOnB();
if (GUI.Button(new Rect(castw(1.1f), casth(4f), width, height), &On&)) {
action.devilEOnB();
if (GUI.Button(new Rect(castw(1.3f), casth(4f), width, height), &On&)) {
action.priestEOnB();
if (GUI.Button(new Rect(castw(2.5f), casth(1.3f), width, height), &Off&)) {
action.offBoatL();
if (GUI.Button(new Rect(castw(1.7f), casth(1.3f), width, height), &Off&)) {
action.offBoatR();
& & & & 当然啦,真正的代码不止这么少,比如要考虑游戏简介的显示(点击左上角会弹出简介框),还要考虑什么时候要隐藏用户操作的按钮(船在行驶的时候和游戏结束的时候)。
& & & & 到此为止,游戏已经基本完成了!
& & & & 整个游戏代码中没有出现 Find、SendMessage 等破坏程序结构的通讯耦合语句,场景中除了主摄像机和一个 Empty 对象外,所有其他的游戏对象都由代码动态生成。
& & & & 事实上,你可以把场景弄得更好看些:
BaseCode.cs
using UnityE
using System.C
using Com.M
namespace Com.Mygame {
public enum State { BSTART, BSEMOVING, BESMOVING, BEND, WIN, LOSE };
* BSTART: boat stops on start shore
* BEND: boat stops on end shore
* BSEMOVING: boat is moving from start shore to end shore
* BESMOVING: boat is moving from end shore to start shore
* LOSE: lose
public interface IUserActions {
void priestSOnB();
void priestEOnB();
void devilSOnB();
void devilEOnB();
void moveBoat();
void offBoatL();
void offBoatR();
void restart();
public class GameSceneController: System.Object, IUserActions {
private static GameSceneController _
private BaseCode _base_
private GenGameObject _gen_game_
public State state = State.BSTART;
public static GameSceneController GetInstance() {
if (null == _instance) {
_instance = new GameSceneController();
public BaseCode getBaseCode() {
return _base_
internal void setBaseCode(BaseCode bc) {
if (null == _base_code) {
_base_code =
public GenGameObject getGenGameObject() {
return _gen_game_
internal void setGenGameObject(GenGameObject ggo) {
if (null == _gen_game_obj) {
_gen_game_obj =
public void priestSOnB() {
_gen_game_obj.priestStartOnBoat();
public void priestEOnB() {
_gen_game_obj.priestEndOnBoat();
public void devilSOnB() {
_gen_game_obj.devilStartOnBoat();
public void devilEOnB() {
_gen_game_obj.devilEndOnBoat();
public void moveBoat() {
_gen_game_obj.moveBoat();
public void offBoatL() {
_gen_game_obj.getOffTheBoat(0);
public void offBoatR() {
_gen_game_obj.getOffTheBoat(1);
public void restart() {
Application.LoadLevel(Application.loadedLevelName);
state = State.BSTART;
public class BaseCode : MonoBehaviour {
public string gameN
public string gameR
void Start () {
GameSceneController my = GameSceneController.GetInstance();
my.setBaseCode(this);
gameName = &Priests and Devils&;
gameRule = &Priests and Devils is a puzzle game in which you will help the Priests and Devils to cross the river within the time limit. There are 3 priests and 3 devils at one side of the river. They all want to get to the other side of this river, but there is only one boat and this boat can only carry two persons each time. And there must be one person steering the boat from one side to the other side. In the flash game, you can click on them to move them and click the go button to move the boat to the other direction. If the priests are out numbered by the devils on either side of the river, they get killed and the game is over. You can try it in many ways. Keep all priests alive! Good luck!
Sphere -- Priest Cube -- Devil&;
GenGameObject.cs
using UnityE
using System.C
using System.Collections.G
using Com.M
public class GenGameObject : MonoBehaviour {
Stack&GameObject& priests_start = new Stack&GameObject&();
Stack&GameObject& priests_end = new Stack&GameObject&();
Stack&GameObject& devils_start = new Stack&GameObject&();
Stack&GameObject& devils_end = new Stack&GameObject&();
GameObject[] boat = new GameObject[2];
GameObject boat_
public float speed = 100f;
GameSceneC
Vector3 shoreStartPos = new Vector3(0, 0, -12);
Vector3 shoreEndPos = new Vector3(0, 0, 12);
Vector3 boatStartPos = new Vector3(0, 0, -4);
Vector3 boatEndPos = new Vector3(0, 0, 4);
float gap = 1.5f;
Vector3 priestStartPos = new Vector3(0, 2.7f, -11f);
Vector3 priestEndPos = new Vector3(0, 2.7f, 8f);
Vector3 devilStartPos = new Vector3(0, 2.7f, -16f);
Vector3 devilEndPos = new Vector3(0, 2.7f, 13f);
void Start () {
my = GameSceneController.GetInstance();
my.setGenGameObject(this);
loadSrc();
void loadSrc() {
Instantiate(Resources.Load(&Prefabs/Shore&), shoreStartPos, Quaternion.identity);
Instantiate(Resources.Load(&Prefabs/Shore&), shoreEndPos, Quaternion.identity);
boat_obj = Instantiate(Resources.Load(&Prefabs/Boat&), boatStartPos, Quaternion.identity) as GameO
// priests & devils
for (int i = 0; i & 3; ++i) {
priests_start.Push(Instantiate(Resources.Load(&Prefabs/Priest&)) as GameObject);
devils_start.Push(Instantiate(Resources.Load(&Prefabs/Devil&)) as GameObject);
Instantiate(Resources.Load(&Prefabs/Light&));
int boatCapacity() {
int capacity = 0;
for (int i = 0; i & 2; ++i) {
if (boat[i] == null) capacity++;
void getOnTheBoat(GameObject obj) {
if (boatCapacity() != 0) {
obj.transform.parent = boat_obj.
if (boat[0] == null) {
obj.transform.localPosition = new Vector3(0, 1.2f, -0.3f);
obj.transform.localPosition = new Vector3(0, 1.2f, 0.3f);
public void moveBoat() {
if (boatCapacity() != 2) {
if (my.state == State.BSTART) {
my.state = State.BSEMOVING;
else if (my.state == State.BEND) {
my.state = State.BESMOVING;
public void getOffTheBoat(int side) {
if (boat[side] != null) {
boat[side].transform.parent =
if (my.state == State.BEND) {
if (boat[side].tag == &Priest&) {
priests_end.Push(boat[side]);
else if (boat[side].tag == &Devil&) {
devils_end.Push(boat[side]);
else if (my.state == State.BSTART) {
if (boat[side].tag == &Priest&) {
priests_start.Push(boat[side]);
else if (boat[side].tag == &Devil&) {
devils_start.Push(boat[side]);
boat[side] =
public void priestStartOnBoat() {
if (priests_start.Count != 0 && boatCapacity() != 0 && my.state == State.BSTART)
getOnTheBoat(priests_start.Pop());
public void priestEndOnBoat() {
if (priests_end.Count != 0 && boatCapacity() != 0 && my.state == State.BEND)
getOnTheBoat(priests_end.Pop());
public void devilStartOnBoat() {
if (devils_start.Count != 0 && boatCapacity() != 0 && my.state == State.BSTART)
getOnTheBoat(devils_start.Pop());
public void devilEndOnBoat() {
if (devils_end.Count != 0 && boatCapacity() != 0 && my.state == State.BEND)
getOnTheBoat(devils_end.Pop());
void setCharacterPositions(Stack&GameObject& stack, Vector3 pos) {
GameObject[] array = stack.ToArray();
for (int i = 0; i & stack.C ++i) {
array[i].transform.position = new Vector3(pos.x, pos.y, pos.z + gap*i);
void check() {
int pOnb = 0, dOnb = 0;
int priests_s = 0, devils_s = 0, priests_e = 0, devils_e = 0;
if (priests_end.Count == 3 && devils_end.Count == 3) {
my.state = State.WIN;
for (int i = 0; i & 2; ++i) {
if (boat[i] != null && boat[i].tag == &Priest&) pOnb++;
else if (boat[i] != null && boat[i].tag == &Devil&) dOnb++;
if (my.state == State.BSTART) {
priests_s = priests_start.Count + pO
devils_s = devils_start.Count + dO
priests_e = priests_end.C
devils_e = devils_end.C
else if (my.state == State.BEND) {
priests_s = priests_start.C
devils_s = devils_start.C
priests_e = priests_end.Count + pO
devils_e = devils_end.Count + dO
if ((priests_s != 0 && priests_s & devils_s) || (priests_e != 0 && priests_e & devils_e)) {
my.state = State.LOSE;
void Update() {
setCharacterPositions(priests_start, priestStartPos);
setCharacterPositions(priests_end, priestEndPos);
setCharacterPositions(devils_start, devilStartPos);
setCharacterPositions(devils_end, devilEndPos);
if (my.state == State.BSEMOVING) {
boat_obj.transform.position = Vector3.MoveTowards(boat_obj.transform.position, boatEndPos, speed*Time.deltaTime);
if (boat_obj.transform.position == boatEndPos) {
my.state = State.BEND;
else if (my.state == State.BESMOVING) {
boat_obj.transform.position = Vector3.MoveTowards(boat_obj.transform.position, boatStartPos, speed*Time.deltaTime);
if (boat_obj.transform.position == boatStartPos) {
my.state = State.BSTART;
else check();
UserInterface.cs
using UnityE
using System.C
using Com.M
public class UserInterface : MonoBehaviour {
GameSceneC
float width,
float castw(float scale) {
return (Screen.width - width) /
float casth(float scale) {
return (Screen.height - height) /
void Start() {
my = GameSceneController.GetInstance();
action = GameSceneController.GetInstance() as IUserA
void OnGUI() {
width = Screen.width / 12;
height = Screen.height / 12;
print (my.state);
if (my.state == State.WIN) {
if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), &Win!&)) {
action.restart();
else if (my.state == State.LOSE) {
if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), &Lose!&)) {
action.restart();
if (GUI.RepeatButton(new Rect(10, 10, 120, 20), my.getBaseCode().gameName)) {
GUI.TextArea(new Rect(10, 40, Screen.width - 20, Screen.height/2), my.getBaseCode().gameRule);
else if (my.state == State.BSTART || my.state == State.BEND) {
if (GUI.Button(new Rect(castw(2f), casth(6f), width, height), &Go&)) {
action.moveBoat();
if (GUI.Button(new Rect(castw(10.5f), casth(4f), width, height), &On&)) {
action.devilSOnB();
if (GUI.Button(new Rect(castw(4.3f), casth(4f), width, height), &On&)) {
action.priestSOnB();
if (GUI.Button(new Rect(castw(1.1f), casth(4f), width, height), &On&)) {
action.devilEOnB();
if (GUI.Button(new Rect(castw(1.3f), casth(4f), width, height), &On&)) {
action.priestEOnB();
if (GUI.Button(new Rect(castw(2.5f), casth(1.3f), width, height), &Off&)) {
action.offBoatL();
if (GUI.Button(new Rect(castw(1.7f), casth(1.3f), width, height), &Off&)) {
action.offBoatR();
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:16967次
排名:千里之外
原创:18篇
评论:11条
(1)(5)(5)(1)(2)(1)(4)

我要回帖

更多关于 牧师与魔鬼 的文章

 

随机推荐