Esempio n. 1
0
File: NPC.cs Progetto: dringy/Hackar
    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);
                }
            }
        }
    }
Esempio n. 2
0
 //Starts the death of the mov
 public void killMob()
 {
     //Firstly while the mob dies we should hold the player
     PlayerController.hold();
     //We then remove the player from the enviroment
     EnviromentMap.removeEnviroment(transform.position.x, transform.position.y, transform.position.z);
     //The death animation is then triggered
     isDying = true;
 }
Esempio n. 3
0
 public RayTracer(IAccelerator acc, Light[] lights, EnvironmentSettings settings)
 {
     this.acc = acc;
     this.maxDepth = settings.RecursionDepth;
     this.rayCache = new Ray[maxDepth+0x01];
     for(int i = 0x00; i < this.maxDepth+0x01; i++) {
         this.rayCache[i] = new Ray(0.0d, 0.0d, 0.0d, 0.0d, 0.0d, 0.0d);
     }
     this.lights = lights;
     this.ambientColor = settings.AmbientColor.Color;
     this.EnvironmentMap = EnvironmentMaps.GetOrBlack(settings.EnvironmentMap);
     this.lightTest = settings.LightTest;
     this.sr = new Ray(new Point3(0.0d, 0.0d, 0.0d), dis);
     this.distanceUnit = settings.DistanceUnit;
 }
Esempio n. 4
0
 public void performPostWalk()
 {
     EnviromentMap.setEnviroment(transform.position.x, transform.position.y, transform.position.z, previousEnviroment);
     transform.Translate(newLocation);
     EnviromentMap.setEnviroment(transform.position.x, transform.position.y, transform.position.z, this);
     if (previousEnviroment != null)
     {
         previousEnviroment.walkAwayFrom();
     }
     previousEnviroment = currentEnviroment;
     move = 0;
     if (currentEnviroment != null)
     {
         currentEnviroment.postWalk(this);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Moves the position of the player.
 /// </summary>
 /// <param name="x">The number of the spaces to move in the x direction</param>
 /// <param name="y">The number of the spaces to move in the y direction</param>
 /// <param name="z">The number of the spaces to move in the z direction</param>
 private void movePosition(int x, int y, int z)
 {
     //Movements are only accepted if there are steps remaining
     if (levelStats.canStep())
     {
         //The movement method is then called in the Enviroment Map, if it's successful the step counter is incremented
         if (EnviromentMap.moveTo(transform.position.x + x, transform.position.y + y, transform.position.z + z, this))
         {
             levelStats.step();
         }
     }
     else
     {
         //If there are no steps remaining a message is displayed
         displayStepLimitMessage();
     }
 }
Esempio n. 6
0
 //Moves the mob in the z direction if possible
 protected virtual bool movePosotiveZ(int z)
 {
     return(EnviromentMap.moveTo(transform.position.x, transform.position.y, transform.position.z + z, this));
 }
Esempio n. 7
0
 //Instanciates the class
 protected void Start()
 {
     //This enviroment object is added to the map
     EnviromentMap.addToMap(transform.position.x, transform.position.y, transform.position.z, transform.localScale.x, transform.localScale.y, transform.localScale.z, this);
 }
Esempio n. 8
0
 //When a trap door opens the mob ontop is killed
 protected override void openTrigger()
 {
     EnviromentMap.killFrozenMobiles();
 }
Esempio n. 9
0
 //When the trap door starts opening, any mob on top is frozen
 protected override void openingTrigger()
 {
     EnviromentMap.freezeMobileOntop(transform.position.x, enviromentPart.getOriginalY(), transform.position.z);
 }