当前位置: 首页>>代码示例>>C#>>正文


C# Room.addOccupant方法代码示例

本文整理汇总了C#中Room.addOccupant方法的典型用法代码示例。如果您正苦于以下问题:C# Room.addOccupant方法的具体用法?C# Room.addOccupant怎么用?C# Room.addOccupant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Room的用法示例。


在下文中一共展示了Room.addOccupant方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Pit

 public Pit(int id, Room room)
 {
     this.id = id;
     this.Type = EntityType.pit;
     location = room;
     location.addOccupant(this);
     UnityEngine.Debug.Log("Pit " + id + " is born in Room " + (location.id + 1));
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:8,代码来源:Pit.cs

示例2: move

 public void move(Room room)
 {
     location.removeOccupant(this);  //leave the current room
         location = room;
         location.addOccupant(this);         //enter the new Room.
         //Debug.WriteLine("Arrow.move(): The arrow is in Room " + (location.id + 1));
         //Console.WriteLine("The arrow is in Room " + (location.id + 1));
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:8,代码来源:Arrow.cs

示例3: Bat

 //TODO: Change the bat name to int id...
 public Bat(string name, Room room)
 {
     //isAlive = true;
     this.name = name;
     this.Type = EntityType.bat;
     location = room;
     location.addOccupant(this);
     UnityEngine.Debug.Log("Bat " + name + " is born in Room " + (location.id + 1));
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:10,代码来源:Bat.cs

示例4: Wumpus

 public Wumpus(string name, Room room)
 {
     isAlive = true;
         this.name = name;
         this.Type = EntityType.wumpus;
         metPlayer = false;
         location = room;
         location.addOccupant(this);
         dice = new System.Random();
         System.Diagnostics.Debug.WriteLine("Wumpus is born in Room " + (location.id + 1));
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:11,代码来源:Wumpus.cs

示例5: move

 public void move(Room room)
 {
     if (location == null){
         location = room;
         location.addOccupant(this);
         }
     else {
         location.removeOccupant(this);  //leave the current room
         location = room;
         location.addOccupant(this);         //enter the new Room.
         }
     UnityEngine.Debug.Log("Player is now in Room " + (location.id + 1));
     this.sense();
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:14,代码来源:Player.cs

示例6: fly

    public void fly(List<Room> path, Room current, Wumpus target)
    {
        //Random rand = new Random();
            location = current;
            location.addOccupant(this);
            int flightLength = 0;

            //TODO: this is ugly, clean up later
            foreach (Room room in path){   //check current length of flight
                if (flightLength < maxFlight){
                    if (location.hasOccupant(target)){
                        target.die();
                        //Console.WriteLine("Aha! You got the Wumpus!");
                        return;
                        }
                    //check if rooms are connected
                    if (location.hasNeighbor(room)){
                        move(room);
                        }
                    else{
                        //Console.WriteLine("Room " + (location.id + 1) + " is not neighbors with Room " +
                                                //	(room.id + 1) + "! Picking another room...");
                        int i = Random.Range(0, location.neighbors.Count - 1);
                        move(location.neighbors[i]);
                        }
                    if (location == current){
                        //Console.WriteLine("Ouch! The arrow got you!");
                        break;
                        }
                    flightLength++;
                    }
            }
            //Console.WriteLine("Missed!");
            target.wake();  //wake the wumpus if you miss
            used = true;
    }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:36,代码来源:Arrow.cs

示例7: move

 public void move(Room room)
 {
     if (location == null){
             location = room;
             location.addOccupant(this);
             }
         else    {
             location.removeOccupant(this);  //leave the current room
             location = room;
             location.addOccupant(this);         //enter the new Room.
             }
         System.Diagnostics.Debug.WriteLine("Wumpus.move() : " + name + " has moved to Room " + (location.id + 1));
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:13,代码来源:Wumpus.cs

示例8: addOccupant

 public void addOccupant(IEntity occupant, Room room)
 {
     occupants.Add(occupant);
     room.addOccupant(occupant);
 }
开发者ID:imperialsoup,项目名称:HuntTheWumpus_3D,代码行数:5,代码来源:Cave.cs


注:本文中的Room.addOccupant方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。