コード例 #1
0
        public int TriggerEvent(Room currentRoom, RoomNavigation dungeon, int i, GameController controller)
        {
            Hazard hazrdInRoom = currentRoom.HazardsInRoom[i];

            hazrdInRoom.HazardEvent(dungeon, controller);

            if (hazrdInRoom.hazard.Equals("Wumpus"))
            {
                return(0);
            }
            if (hazrdInRoom.hazard.Equals("Bottomless Pit"))
            {
                return(1);
            }
            if (hazrdInRoom.hazard.Equals("Superbat"))
            {
                return(2);
            }
            return(-1);
        }
コード例 #2
0
        //private bool pause = true;


        // Use this for initialization
        public void Awake()
        {
            RoomNavigation      = GetComponent <RoomNavigation>();
            InteractableObjects = GetComponent <InteractableObjects>();

            EndOfGame       = false;
            TriggeredHazard = false;
            PlayerDead      = false;
            WumpusDead      = false;
            WumpusAwake     = false;
            StartinRoom     = RoomNavigation.CurrentRoom;
            _setUp          = new int[Hazards.Length];
            NumArrows       = 5;

            _numHazards = 0;

            while (_numHazards < Hazards.Length)
            {
                int choosenRoom = Random.Range(0, 20);

                if (RoomNavigation.Dungeon[choosenRoom].HazardsInRoom[0] == null && RoomNavigation.Dungeon[choosenRoom].RoomName != StartinRoom.RoomName)
                {
                    RoomNavigation.Dungeon[choosenRoom].HazardsInRoom[0] = Hazards[_numHazards];
                    _setUp[_numHazards] = choosenRoom;
                    _numHazards++;
                }
            }

            for (int i = 0; i < Hazards.Length; i++)
            {
                if (Hazards[i].GetType() == typeof(Wumpus))
                {
                    _wumpus = i;
                }
            }

            ((Wumpus)Hazards[_wumpus]).SetLocation(RoomNavigation.Dungeon[_setUp[_wumpus]]);
        }
コード例 #3
0
 public override void HazardEvent(RoomNavigation dungeon, GameController controller)
 {
     dungeon.CurrentRoom = dungeon.Dungeon[Random.Range(0, 20)];
 }
コード例 #4
0
 public abstract void HazardEvent(RoomNavigation dungeon, GameController controller);
コード例 #5
0
 public override void HazardEvent(RoomNavigation dungeon, GameController controller)
 {
     controller.PlayerDead = true;
 }