Пример #1
0
    public void checkForPlayer()
    {
        //The npc only does something if it doesn't ignore the player
        if (action != playerAction.Ignore)
        {
            PlayerController player;
            //It then attempts to spot a player given it's direction, sightlength and spotlength
            //It calls EnviromentMap functions for this
            switch (directionFacing)
            {
            case direction.posotiveX:
            {
                player = EnviromentMap.findPlayerLookingPosotiveX(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            case direction.negativeX:
            {
                player = EnviromentMap.findPlayerLookingNegativeX(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            case direction.posotiveZ:
            {
                player = EnviromentMap.findPlayerLookingPosotiveZ(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }

            default:
            {
                player = EnviromentMap.findPlayerLookingNegativeZ(transform.position.x, transform.position.y,
                                                                  transform.position.z, sightLength, soundLength);
                break;
            }
            }

            //If a player was found we can then act
            if (player != null)
            {
                //If the kill action is present then we reset the level
                if (action == playerAction.Kill)
                {
                    Application.LoadLevel(Application.loadedLevelName);
                }
                //If the teleport ation is present we display a times message and teleport the player
                else
                {
                    LevelGUI.displayTimedMessage(this.name + " spotted you and teleported you.");
                    //player.triggerWalkAwayDueToTeleport ();
                    EnviromentMap.moveTo(teleX, teleY, teleZ, player);
                }
            }
        }
    }
Пример #2
0
 //When the mouse if over the object and the user clicks then the Hack GUI is updated
 void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
     {
         if (isHackLocked)
         {
             LevelGUI.displayTimedMessage(name + " is hack locked.");
         }
         else
         {
             LevelGUI.displayGUI(this);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Displays the step limit message.
 /// </summary>
 private void displayStepLimitMessage()
 {
     //If we run out of steps we display a timed message
     LevelGUI.displayTimedMessage("Exceeded Step Limit");
 }