Ejemplo n.º 1
0
    private void DeleteControlPoint()
    {
        PathGenerator PathGen;

        PathGen = FlightPathGen;

        if (IsFightControlPointSelected == false)
        {
            PathGen = RoiPathGen;

            Simulator.DeleteRoiControlPoint();
        }
        else
        {
            Simulator.DeleteFlightControlPoint();
        }

        PathGen.DeleteControl();

        if (IsFightControlPointSelected == true)
        {
            CalcFlightPath();
        }
        else
        {
            CalcROIPath();
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        pathFinder = this.GetComponent <AStar> ();

        health = transform.GetComponent <Health> ();
        AI     = transform.GetComponent <Player> ();
        AI.setIsAI(true);

        playerFinder = transform.GetComponent <PlayerFinder> ();
        player       = playerFinder.getPlayer().gameObject;

        playerHealth = player.GetComponent <Health> ();
        //Movement
        playerComponent = player.GetComponent <Player> ();
        AIHeight        = transform.GetComponent <BoxCollider2D> ().bounds.size.y;

        pathGen = GameObject.Find("Platforms").GetComponent <PathGen> ();

        path = pathFinder.FindShortestPath(playerComponent);
        if (path != null)
        {
            target = path [0];
            path.RemoveAt(0);
        }

        // Movement State
        state = States.Follow;

        //Same Platform Movement
        inMotion  = false;
        mightJump = true;

        stuckOnWrongPlatform = 0f;
    }
    private void Start()
    {
        roomGen     = GetComponent <RoomGen>();
        tileGen     = GetComponent <TileGen>();
        pathGen     = GetComponent <PathGen>();
        mouseStatus = GetComponent <MouseStatus>();

        rooms = new List <Room>();
    }
 private static void ClonePath(PathGen pathGen, Clone clone, bool symlink = true)
 {
     if (symlink)
     {
         Junction.Create(pathGen(clone), pathGen(clones.master), false);
     }
     else
     {
         FileIO.ProcessXcopy(pathGen(clones.master), pathGen(clone));
     }
 }
Ejemplo n.º 5
0
 public ActionResult Edit(CategoryProductMediaRModel cpmvm, HttpPostedFileBase file)
 {
     if (cpmvm.IsThumbnail == true)
     {
         string fileName = Path.GetFileName(file.FileName);
         ThumGen.Crop(320, 240, file.InputStream, Path.Combine(Server.MapPath("/img/thumb/") + fileName));
     }
     cpmvm.FilePathOrLink = PathGen.PathGena(file);
     db.Update(cpmvm);
     return(RedirectToAction("Index"));
 }
Ejemplo n.º 6
0
    void connectRooms()
    {
        int                tries = 0;
        List <GridSpot>    path  = new List <GridSpot>();
        List <DoorwaySpot> doors = new List <DoorwaySpot> ();

        foreach (Room room in rooms)
        {
            foreach (DoorwaySpot door in room.getDoorways())
            {
                doors.Add(door);
            }
        }

        while (doors.Count > 1)             //As long as there are at least two doors left on the map
        {
            int         ranDoorOne = Random.Range(0, doors.Count);
            DoorwaySpot doorOne    = doors[ranDoorOne];
            doors.RemoveAt(ranDoorOne);

            int         ranDoorTwo = Random.Range(0, doors.Count);
            DoorwaySpot doorTwo    = doors[ranDoorTwo];
            doors.RemoveAt(ranDoorTwo);

            if (doorOne.parentRoom().Equals(doorTwo.parentRoom()))                   //Doors should not be from the same room
            {
                doors.Add(doorOne);
                doors.Add(doorTwo);
            }
            else
            {
                path = PathGen.getPath(map, doorOne, doorTwo, path);
                foreach (GridSpot spot in path)
                {
                    HallwaySpot hallway = new HallwaySpot(spot.Coord(), hallwayTile, true);
                    map.addTile(hallway);
                }

                map.addTile(doorOne);
                map.addTile(doorTwo);

                path.Clear();
            }

            if (tries >= maxTries)
            {
                Debug.LogError("Infinite Loop");
            }
        }

        if (doors.Count == 1)
        {
            for (int i = 0; i < rooms.Count; i++)
            {
                if (!(doors[0].parentRoom().Equals(rooms[i])))
                {
                    DoorwaySpot last = rooms[i].getDoorways()[0];

                    path = PathGen.getPath(map, last, doors[0], path);
                    foreach (GridSpot spot in path)
                    {
                        HallwaySpot hallway = new HallwaySpot(spot.Coord(), hallwayTile, true);
                        map.addTile(hallway);
                    }

                    map.addTile(last);
                    map.addTile(doors[0]);

                    doors.RemoveRange(0, doors.Count - 1);
                    break;
                }
            }
        }

        doors = null;
        path  = null;
    }