Esempio n. 1
0
 public Stair(Vector2 enterPos, Vector2 outPos, Floor destination, StairCase target)
 {
     this.enterPos = enterPos;
     this.outPos = outPos;
     this.destination = destination;
     this.target = target;
 }
Esempio n. 2
0
    public bool createGenerator(Floor end)
    {
        if(!isEmpty())
            return false;

        has=terrain.generator;
        GameObject generatorObject = (GameObject)Instantiate(	generatorPrefab,
                                    new Vector3(transform.position.x, transform.position.y, transform.position.z),
                                    Quaternion.identity
                                );

        GameObject laserObject = (GameObject)Instantiate(	laserPrefab,
                                    new Vector3(transform.position.x, transform.position.y, transform.position.z),
                                    Quaternion.identity
                                );
        laserObject.GetComponent<Laser>().setOriginEnd(generatorObject, end.gameObject);

        Vector3 vect = end.gameObject.transform.position - generatorObject.transform.position;

        float ang=Vector3.Angle(new Vector3(0,0,1), vect);

        if(vect.x<0)
            ang=ang*(-1);

        generatorObject.transform.Rotate(new Vector3(0, ang, 0 ));

        currentObject = generatorObject;
        generatorObject.tag = "Generator";

        emitMineralSprite ("-", GameController.generatorCost.ToString());
        emitParticles(1);

        return true;
    }
Esempio n. 3
0
        public Meeple(Game game, Floor floor)
            : base()
        {
            CurrentFloor = floor.Number;

            // Gotta pick a floor that's not this one.
            int goingUp = game.Random.Next(2);
            // GOING UP, unless we're on the top floor
            if (goingUp == 1 && CurrentFloor != Game.NUMBER_OF_FLOORS - 1)
            {
                Destination = game.Random.Next(CurrentFloor + 1, Game.NUMBER_OF_FLOORS);
            }

            // GOING DOWN, unless we're on the bottom floor
            else if (CurrentFloor != 0)
            {
                Destination = game.Random.Next(CurrentFloor);
            }

            // GOING UP, because we're on the bottom floor
            else
            {
                Destination = game.Random.Next(0, Game.NUMBER_OF_FLOORS);
            }

            // because meeple get frustrated
            Patience = Math.Abs(Destination - CurrentFloor) * Meeple.FrustrationCoefficient + 3;
            Id = _maxId++;
            InElevator = false;
        }
Esempio n. 4
0
    public void GenerateCave(Floor floor)
    {
        FillWithRock (floor);
        //		RandomlyPlaceFloor (floor, 50);

        RandomFloor (floor, 50);

        Generate (floor);
        //
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        RandomlyDistrabute (floor, 50);
        Generate (floor);
        Generate (floor);
        Generate (floor);
        Generate (floor);
        Generate (floor);
    }
    /*
    void Update()
    {

    }
    */
    //****************************************************************************************************
    //*** Functions
    public void MakeFloor()
    {
        // Remove last Floor (except theres an Editor-Test-Level generated already)
        RemoveFloor();

        // Instantiate a new Floor
        activeFloor = new Floor(Global.global.floorSizeX, Global.global.floorSizeZ);

        // Instantiate new Tile-Blocks based on new Floor-Data
        for(int x=0; x<Global.global.floorSizeX; x++)
        {
        for(int z=0; z<Global.global.floorSizeZ; z++)
        {
            byte tile = activeFloor.blockMap[x, z];
            if(tile < 254)
            {
                GameObject tb = Instantiate(tileBlock, new Vector3(x, 0, z), Quaternion.identity) as GameObject;
                tb.renderer.material = materials[tile];

                // group as child into "LEVEL"-GameObject
                tb.transform.parent = this.transform;
            }
        }
        }

        MakeGround();

        SetPlayerPosition();

        SetLightSources();

        MakeMap();

        PositionEnemies();
    }
Esempio n. 6
0
    /// <summary>
    /// Used to generate all rooms.
    /// </summary>
    /// <description> Generates all rooms by calling the GenerateRoom function until there is either
    /// no more possible room locations in the list PossibleRoomLocations or the amount of rooms made
    /// has hit the target number of rooms specified in the inspector. If it has been specified in the 
    /// inspector to make as many rooms as possible, the target number of rooms will be changed to a 
    /// very large number which would not be possible to complete. </description>
    /// <param name="floor">Floor to generate rooms on</param>
    public void GenerateAllRooms(Floor floor)
    {
        if (floor.reflectRoomsX) reflectX = true;
        else reflectX = false;

        if (floor.reflectRoomsZ) reflectZ = true;
        else reflectZ = false;

        if (asManyAsPossible) targetNumOfRooms = 1000;

        bool finished = false;

        GenerateCentralRoom ();

        while (!finished) {

            if (PossibleRoomLocations ().Count > 0 && targetNumOfRooms > roomList.Count) {

                GenerateRoom ();
            }
            else finished = true;
        }

        if (reflectX) ReflectX ();
        if (reflectZ) ReflectZ ();

        //ConnectRooms (roomList[0], roomList[1]);
    }
 void ElevatorListener.FloorArrived(Floor arrived)
 {
     if (floorOfCallButton == arrived) {
         StatusBtnLight(true);
         blinking = true;
     }
 }
Esempio n. 8
0
 public void SetFloor(Floor newFloor)
 {
     _isOnStair = false;
     // Debug.Log("newFloor");
     currentFloor = newFloor;
     if (body.velocity.y < -0.5f)
         CrackSound();
 }
        public AimingArrow(PuzzleBooble3dGame game, Floor floor)
            : base(game)
        {
            Floor = floor;

            AngleZ = 0;
            Position = Floor.Position + new Vector3(Floor.WIDTH/2, 0, Ball.BALL_RADIUS);
        }
 public bool IsNextTo(Floor otherFloor)
 {
     int diffX = this.X - otherFloor.X;
     int diffY = this.Y - otherFloor.Y;
     if (diffX == 0 || diffY == 0)
         return (System.Math.Abs(diffX + diffY) == 1);
     return false;
 }
Esempio n. 11
0
    // Use this for initialization
    void Start()
    {
        floor = GetComponent<Floor>(); // find the floor game object

        timerValue = spawnSpeed;

        player = GameObject.FindGameObjectWithTag("Player");
    }
Esempio n. 12
0
    public House(int _size)
    {
        size = _size;

        attic = new Floor(size, FloorType.Attic);
        ground = new Floor(size, FloorType.Ground);
        basement = new Floor(size, FloorType.Basement);
    }
Esempio n. 13
0
 void DrawFloor(Floor floor, int yOffset)
 {
     for(int i=0; i<floor.rooms.Count; i++)
     {
         Room room = floor.rooms[i];
         DrawRoom (room, 50*(i+1), yOffset);
     }
 }
Esempio n. 14
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="floor">floor to create reinforcement on</param>
 /// <param name="commandData">object which contains reference to Revit Application</param>
 public ProfileFloor(Floor floor, ExternalCommandData commandData)
     : base(commandData)
 {
     m_data = floor;
     List<List<Edge>> faces = GetFaces(m_data);
     m_points = GetNeedPoints(faces);
     m_to2DMatrix = GetTo2DMatrix();
 }
Esempio n. 15
0
    Floor theFloor;     // the floor object - used by customers for pathfinding

    // CONSTRUCTOR for the class
    public FilmShowing(int id, int screenNumber, int tickets, int hours, int minutes, Floor f)
    {
        screeningID = id;
        screenNum = screenNumber;
        ticketsSold = tickets;
        timeH = hours;
        timeM = minutes;
        theFloor = f;
    }
    public void FloorPassed(Floor passed)
    {
        //     Debug.Log("set mat");
         //   ledMat.mainTexture = numbers[FloorUtility.Index(passed)];
          //  ledMat.SetTexture("_EmissionMap", ledMat.mainTexture);
          //  ledMat.SetColor("_EmissionColor", Color.white);
          //  DynamicGI.SetEmissive(GetComponent<Renderer>(), Color.white);

        GetComponent<Renderer>().material = numbers[FloorUtility.Index(passed)];
    }
Esempio n. 17
0
 public void CreateCourse()
 {
     if (!IsCourseCreated) {
         FloorList floors = CreateFloorList();
         Floor = floors.Head;
         GetComponent<MeshFilter> ().sharedMesh = floors.Mesh;
         GetComponent<MeshFilter> ().sharedMesh.name = "courseMesh";
         IsCourseCreated = true;
     }
 }
Esempio n. 18
0
 public void CallToFloor(Floor floor)
 {
     targetFloors |= (int)floor;
     if (IsStanding()) {
         currentTargetFloor = floor;
     }
     else {
         CalculateNearestTargetFloor();
     }
 }
Esempio n. 19
0
 public FloorSearcher(Vector2 startingPos, Vector2 targetPos, Floor startingFloor = null, Floor targetFloor = null, StairCase startingStair = null, StairCase targetStair = null)
 {
     pathList = new List<List<Vector2>>();
     this.startingPos = startingPos;
     this.targetPos = targetPos;
     this.startingFloor = startingFloor;
     this.targetFloor = targetFloor;
     this.startingStair = startingStair;
     this.targetStair = targetStair;
 }
Esempio n. 20
0
        public Floor FirstFloor()
        {
            var firstFloor = new Floor {

                 FloorID = null,
                 FloorValue = null

             };

            return firstFloor;
        }
Esempio n. 21
0
        public Floor ThirdFloor()
        {
            var thirdFloor = new Floor {

                 FloorID = null,
                 FloorValue = null

             };

            return thirdFloor;
        }
Esempio n. 22
0
    public Customer(FilmShowing fs, int ID, Floor f, Controller c, Customer_Controller cc)
    {

        pointsToVisit = new List<Coordinate>();
        theFloor = f;
        mainController = c;
        customerController = cc;

        filmShowing = fs;

        index = ID;

        needsFood = Random.Range(0, 10) >= 5;         
        needsTickets = Random.Range(0, 10) >= 0;      // 3
        needsToilet = Random.Range(0, 10) >= 6;

        if (needsFood)
        {

            if (Controller.foodArea != null)
            {

                int rand = Random.Range(0, 15);
                if (rand < 8) { foodDesired = 0; }
                else if (rand < 13) { foodDesired = 1; }
                else { foodDesired = 2; }
            }
            else
            {
                needsFood = false;
                foodDesired = -1;
                patience -= 150;
            }
        }

        int minutesEarly = Random.Range(35, 95);

        try
        {
            int hourStart = fs.timeH;
            int minuteStart = fs.timeM;


            hourDue = hourStart - (minutesEarly / 60);
            minuteDue = minuteStart - minutesEarly - ((hourDue - hourStart) * 60);

            if (minuteDue < 0)
            {
                minuteDue += 60;
                hourDue--;
            }
        }
        catch (Exception) { }
    }
Esempio n. 23
0
        public Floor SecondFloor()
        {
            var secondFloor = new Floor {

                 FloorID = null,
                 FloorValue = null

             };

            return secondFloor;
        }
Esempio n. 24
0
  public static void Main(string[] args) {
    Table env = new Table();
    Symbol k;
    object v;

    k = Lua.Symbol.Intern("print");
    v = new Print();
    env[k] = v;

    k = Lua.Symbol.Intern("setmetatable");
    v = new SetMetatable();
    env[k] = v;

    k = Lua.Symbol.Intern("pairs");
    v = new Pairs();
    env[k] = v;

    Lua.Symbol s = Lua.Symbol.Intern("tonumber");
    k = s;
    v = new ToNumber();
    env[k] = v;

    k = Lua.Symbol.Intern("os");
    Table os = new Table();
    v = os;
    env[k] = v;
    k = Lua.Symbol.Intern("clock");
    v = new Clock();
    os[k] = v;

    k = Lua.Symbol.Intern("io");
    Table io = new Table();
    v = io;
    env[k] = v;
    k = Lua.Symbol.Intern("write");
    v = new Write();
    io[k] = v;

    k = Lua.Symbol.Intern("math");
    Table math = new Table();
    v = math;
    env[k] = v;
    k = Lua.Symbol.Intern("floor");
    v = new Floor();
    math[k] = v;

    Closure c = (Closure)Assembly.LoadFrom(args[0] + ".dll").
      GetType(args[0] + ".function1").GetConstructor(new Type[0]).
      Invoke(new object[0]);
    c.Env = env;
    c.InvokeS();
    for(int i = 0; i <= System.GC.MaxGeneration; i++)
      Console.WriteLine(System.GC.CollectionCount(i));
  }
	void Update () {

        if (Time.time > nextFloor && !isGameStop)
        {
            int randomNum = Random.Range(0, floorType.Length);
            newfloor = Instantiate(floorType[randomNum], transform.position, transform.rotation) as Floor;
            newfloor.transform.parent = stage.transform;

            nextFloor += interval;
        }

    }
Esempio n. 26
0
 protected override void OnStart()
 {
     _timeSinceStateChanged = 0;
     if (_hero == null)
     {
         _hero = MonobehaviorHandler.GetMonobeharior().GetObject<Floor>("Floor").GetHero();
     }
     if (_floor == null)
     {
         _floor = MonobehaviorHandler.GetMonobeharior().GetObject<Floor>("Floor");
     }
 }
Esempio n. 27
0
 public static Floor CreateFloor(List<Room> rooms, string floorName)
 {
     Floor floor = new Floor ();
     floor.rooms = rooms;
     foreach(Room room in rooms)
     {
         room.floor = floor;
     }
     floor.floorName = floorName;
     floors.Add (floor);
     return floor;
 }
Esempio n. 28
0
 public void Test1()
 {
     var groundFloor = new Floor(0);
     var lift = new Lift(groundFloor);
     var events = new List<LiftArrivedEvent>();
     lift.ArriveAtFloor += events.Add;
     var firstFloor = new Floor(1);
     lift.Summon(firstFloor, Direction.Down);
     Assert.That(events.Count, Is.EqualTo(1));
     Assert.That(events[0].Direction, Is.EqualTo(Direction.Down));
     Assert.That(events[0].Floor, Is.EqualTo(firstFloor));
 }
Esempio n. 29
0
  public static void Main(string[] args) {
    Table env = new Table();
    Symbol k;
    object v;

    k = Lua.Symbol.Intern("print");
    v = new Print();
    env[k] = v;

    k = Lua.Symbol.Intern("setmetatable");
    v = new SetMetatable();
    env[k] = v;

    k = Lua.Symbol.Intern("pairs");
    v = new Pairs();
    env[k] = v;

    Lua.Symbol s = Lua.Symbol.Intern("tonumber");
    k = s;
    v = new ToNumber();
    env[k] = v;

    k = Lua.Symbol.Intern("os");
    Table os = new Table();
    v = os;
    env[k] = v;
    k = Lua.Symbol.Intern("clock");
    v = new Clock();
    os[k] = v;

    k = Lua.Symbol.Intern("io");
    Table io = new Table();
    v = io;
    env[k] = v;
    k = Lua.Symbol.Intern("write");
    v = new Write();
    io[k] = v;

    k = Lua.Symbol.Intern("math");
    Table math = new Table();
    v = math;
    env[k] = v;
    k = Lua.Symbol.Intern("floor");
    v = new Floor();
    math[k] = v;

    function1 f = new function1();
    f.Env = env;
    f.InvokeS();
    for(int i = 0; i <= System.GC.MaxGeneration; i++)
      Console.WriteLine(System.GC.CollectionCount(i));
  }
Esempio n. 30
0
        public void Initialize(float _timeToLive, float _timeCreated, GameObject _parent_go)
        {
            timeToLive = _timeToLive;
            timeCreated = _timeCreated;
            parent_go = _parent_go;

            GameObject floor_go = GameObject.FindGameObjectWithTag("Floor");
            if (floor_go != null)
                floor = floor_go.GetComponent<Floor>();

            if (floor == null)
                Debug.LogError("ColorBombBall can't find Floor!");
        }
Esempio n. 31
0
 public void SetFloor(Floor _floor)
 {
     this.floor = _floor;
 }
Esempio n. 32
0
        private void createLiningConcreteAsFloor2(Document doc, ElementId myFoundtionId, string nameFamily, double offsetValue)

        {
            Element myFoundation = doc.GetElement(myFoundtionId) as Element;

            //Get level from elemet
            Level myLevel = doc.GetElement(myFoundation.LevelId) as Level;

            //Get geometry from element
            GeometryElement geometryElement = myFoundation.get_Geometry(new Options());

            //Get list Of face (with normal vector = xyz(0,0,-1);

            List <Face> myListBottomFace = new List <Face>();

            using (Transaction myTrans = new Transaction(doc, "fil face of foundation"))
            {
                myTrans.Start();
                UV myPoint = new UV(0, 0);

                foreach (GeometryObject geometryObject in geometryElement)
                {
                    if (geometryObject is Solid)
                    {
                        Solid solid     = geometryObject as Solid;
                        XYZ   myNormVec = new XYZ();
                        foreach (Face myFace in solid.Faces)
                        {
                            myNormVec = myFace.ComputeNormal(myPoint);

                            // If normal vector of face has Z value == -1 add to list
                            if (Math.Round(myNormVec.Z, 1) == -1.0)
                            {
                                myListBottomFace.Add(myFace);
                            }
                        }
                    }
                }
                myTrans.Commit();
            }

            // Now We has a list of face (with normal vector = (0,0,-1)

            //Save floor to a list

            List <Floor> myListLining = new List <Floor>();


            using (Transaction trans = new Transaction(doc, "abc"))
            {
                trans.Start();
                foreach (Face myPickedFace in myListBottomFace)
                {
                    //Get Nomarl vector
                    XYZ myNorVecFace = myPickedFace.ComputeNormal(new UV(0, 0));
                    List <CurveLoop> myListCurvefromFace = myPickedFace.GetEdgesAsCurveLoops() as List <CurveLoop>;


                    CurveArray myBoundaFloor = new CurveArray();

                    foreach (CurveLoop myCurLoop in myListCurvefromFace)
                    {
                        if (myFoundation.Category.Name != "Structural Framing")
                        {
                            // Offset For Slab
                            CurveLoop curOffset = CurveLoop.CreateViaOffset(myCurLoop, offsetValue, myNorVecFace);
                            //TaskDialog.Show("abc", "xyz: " +curOffset.GetPlane().Normal.ToString());

                            foreach (Curve myCur in curOffset)
                            {
                                myBoundaFloor.Append(myCur);
                            }
                        }

                        else
                        {
                            List <double> myOffsetDist = getOffsetDis(myCurLoop, offsetValue);


                            CurveLoop curOffset = CurveLoop.CreateViaOffset(myCurLoop, myOffsetDist, myNorVecFace);
                            //TaskDialog.Show("abc", "xyz: " +curOffset.GetPlane().Normal.ToString());

                            foreach (Curve myCur in curOffset)
                            {
                                myBoundaFloor.Append(myCur);
                            }
                        }
                    }

                    FloorType floorType
                        = new FilteredElementCollector(doc)
                          .OfClass(typeof(FloorType))
                          .OfCategory(BuiltInCategory.OST_Floors)
                          .First <Element>(f => f.Name.Equals(nameFamily)) as FloorType;

                    //Floor myLining =  doc.Create.NewFoundationSlab(myBoundaFloor, floorType, myLevel, true, new XYZ(0,0,1));

                    //Floor myLining =  doc.Create.NewFloor(myBoundaFloor, floorType, myLevel, true, new XYZ(0,0,1));

                    Floor myLining = doc.Create.NewFloor(myBoundaFloor, floorType, myLevel, true, new XYZ(0, 0, 1));

                    myListLining.Add(myLining);
                }
                trans.Commit();
            }

            // Switch Joint
            if (myListLining.Count() < 1)
            {
                return;
            }
            else
            {
                foreach (Floor myLining in myListLining)
                {
                    switchJoinOrder(doc, myLining);
                }
            }
        }
Esempio n. 33
0
 /// <summary>
 /// 将该格位置给player
 /// </summary>
 /// <param name="a"></param>
 /// <param name="floor"></param>
 static void PlayerChangePosition(ref player a, Floor floor)
 {
     a.position.x = floor.position.x;
     a.position.y = floor.position.y;
 }
Esempio n. 34
0
        protected override void Init()
        {
            base.FromWorldMap(
                typeof(RealmManager).Assembly.GetManifestResourceStream("wServer.realm.worlds.tower.floor" + Floor.ToString() + ".wmap"));

            IntPoint    descendPos = GetRandomTile(TileRegion.Spawn);
            TowerPortal descend    = new TowerPortal(Manager, Floor - 1);

            descend.Move(descendPos.X + 0.5f, descendPos.Y + 0.5f);
            EnterWorld(descend);
        }
 /// <summary>
 /// Function that returns queue.
 /// </summary>
 /// <param name="floor"></param>
 /// <returns></returns>
 public PeopleQueue GetQuery(Floor floor)
 {
     return(Queues.FirstOrDefault(p => p.NumberOfFloor == floor));
 }
Esempio n. 36
0
    /// <summary>
    /// Parses GeoJSON into building objects and draws them
    /// </summary>
    /// <param name="text">GeoJSON string</param>
    private void GetBuildings(string text)
    {
        _mazemapBackup = File.Exists(string.Format(_backupPath, CampusId)) ? JsonUtility.FromJson <MazemapBackupFile>(File.ReadAllText(string.Format(_backupPath, CampusId))) : new MazemapBackupFile();

        if (string.IsNullOrEmpty(text))
        {
            CampusJson campus;

            if (_mazemapBackup.Campuses.TryGetValue(CampusId, out campus))
            {
                Debug.Log("Couldn't connect to Mazemap: Initialising from backup");
                text                     = campus.BuildingsJson;
                _isUsingBackup           = true;
                _shouldBackupMazemapData = false;
            }
            else
            {
                Debug.LogError("Couldn't connect to Mazemap - Backup not found: Exiting");
                return;
            }
        }

        if (_shouldBackupMazemapData && _mazemapBackup != null)
        {
            if (_mazemapBackup.Campuses == null)
            {
                _mazemapBackup.Campuses = new SerializableDictionaryCampusJson();
            }
            if (_mazemapBackup.Campuses.ContainsKey(CampusId))
            {
                _mazemapBackup.Campuses.Remove(CampusId);
            }

            _mazemapBackup.Campuses.Add(CampusId, new CampusJson
            {
                BuildingsJson = text,
                Floors        = new SerializableDictionaryIntString(),
                Rooms         = new SerializableDictionaryIntString()
            });
        }

        CampusLoaded = false;
        JSONObject collection = new JSONObject(text);

        foreach (JSONObject building in collection["buildings"])
        {
            Building b = new Building
            {
                Name        = building["buildingNames"][0]["name"].str,
                Id          = (int)building["buildingNames"][0]["id"].f,
                BuildingId  = (int)building["buildingNames"][0]["buildingId"].f,
                AccessLevel = (int)building["accessLevel"].f,
                CampusId    = (int)building["campusId"].f
            };

            foreach (JSONObject floor in building["floors"])
            {
                Floor f = new Floor
                {
                    Id             = (int)floor["id"].f,
                    Name           = floor["name"].str,
                    AccessLevel    = (int)floor["accessLevel"].f,
                    FloorIndex     = (int)floor["z"].f,
                    FloorOutlineId = (int)floor["floorOutlineId"].f,
                };
                if (f.FloorIndex > 0)
                {
                    f.FloorIndex--;
                }
                b.Floors.Add(f.Id, f);
            }
            Buildings.Add(b.Id, b);
        }

        StartCoroutine(DrawAllBuildings());
    }
Esempio n. 37
0
 public Tile East() => Floor.GetTile(ref _east, Location.Shift(0, -1, 1));
Esempio n. 38
0
 public Tile SouthWest() => Floor.GetTile(ref _southWest, Location.Shift(-1, 0, -1));
Esempio n. 39
0
 public Tile NorthWest() => Floor.GetTile(ref _northWest, Location.Shift(1, 1, 0));
Esempio n. 40
0
 public Tile SouthEast() => Floor.GetTile(ref _southEast, Location.Shift(-1, -1, 0));
Esempio n. 41
0
 public Tile West() => Floor.GetTile(ref _west, Location.Shift(0, 1, -1));
Esempio n. 42
0
 protected Item(Floor floor, Cell cell, char data)
 {
     this.floor = floor;
     Position   = cell;
     ID         = data;
 }
Esempio n. 43
0
 // Use this for initialization
 void Start()
 {
     _nextDish = SelectNextDish();
     _dishes   = new List <DishInstance>();
     _floor    = Floor.GetComponent <Floor>();
 }
Esempio n. 44
0
        public void RenderWorld(RenderTarget2D renderTarget)
        {
            floorSprite = new RenderableSpriteComponent()
            {
                Texture = Util.CurrentFloor.FloorTexture
            };

            graphics.SetRenderTarget(renderTarget);

            spriteBatch.Begin(); //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
            graphics.Clear(Color.White);

            // seen by player
            var seenPositions = Util.CurrentFloor.GetSeenPositions().ToArray();

            Position playerPos = Util.GetPlayerPos();
            Floor    floor     = Util.CurrentFloor;

            // camera capped to floor
            int minX = Math.Max(0, Math.Min(floor.Width - Util.WorldViewTileWidth, playerPos.X - Util.WorldViewTileWidth / 2));
            int minY = Math.Max(0, Math.Min(floor.Height - Util.WorldViewTileHeight, playerPos.Y - Util.WorldViewTileHeight / 2));

            // camera uncapped
            //int minX = playerPos.X - Util.WorldViewTileWidth / 2;
            //int minY = playerPos.Y - Util.WorldViewTileHeight / 2;

            min = new Position(minX, minY);

            for (int y = 0; y < Util.WorldViewTileHeight; y++)
            {
                for (int x = 0; x < Util.WorldViewTileWidth; x++)
                {
                    var relScreenPos = new Position(x, y);
                    var worldPos     = min + relScreenPos;

                    Tile tile = floor.GetTile(worldPos);

                    if (FogOfWarEnabled && !tile.Discovered)
                    {
                        DrawSprite(blackSquare, relScreenPos);
                        continue;
                    }

                    if (tile.Terrain == 0)
                    {
                        DrawSprite(floorSprite, relScreenPos);
                    }
                    else
                    {
                        var sprite = EntityManager.GetComponent <RenderableSpriteComponent>(tile.Terrain);

                        if (sprite != null && sprite.Visible)
                        {
                            DrawSprite(sprite, relScreenPos);
                        }
                    }

                    if (tile.Structure != 0)
                    {
                        var sprite = EntityManager.GetComponent <RenderableSpriteComponent>(tile.Structure);

                        if (sprite != null && sprite.Visible)
                        {
                            var multiTileC = EntityManager.GetComponent <MultiTileComponent>(tile.Structure);

                            if (multiTileC == null)
                            {
                                DrawSprite(sprite, relScreenPos);
                            }
                            else
                            {
                                var relAnchor = multiTileC.Anchor - min;
                                DrawSpriteMultiTile(sprite, relScreenPos, relAnchor, multiTileC.Width);
                            }
                        }
                    }

                    if (FogOfWarEnabled && !seenPositions.Contains(worldPos))
                    {
                        DrawSprite(greySquare, relScreenPos);
                        continue;
                    }

                    if (tile.Items != null && tile.Items.Count > 0)
                    {
                        var sprite = EntityManager.GetComponent <RenderableSpriteComponent>(tile.Items.Last());

                        if (sprite != null && sprite.Visible)
                        {
                            DrawSprite(sprite, relScreenPos);
                        }
                    }

                    if (tile.Character != 0)
                    {
                        //Log.Data(DescriptionSystem.GetDebugInfoEntity(tile.Character));
                        var sprite = EntityManager.GetComponent <RenderableSpriteComponent>(tile.Character);

                        if (sprite != null && sprite.Visible)
                        {
                            var multiTileC = EntityManager.GetComponent <MultiTileComponent>(tile.Character);

                            if (multiTileC == null)
                            {
                                DrawSprite(sprite, relScreenPos);
                            }
                            else
                            {
                                var relAnchor = multiTileC.Anchor - min;
                                DrawSpriteMultiTile(sprite, relScreenPos, relAnchor, multiTileC.Width);
                            }
                        }
                    }

                    if (tile.DebugInfo.Length > 0)
                    {
                        spriteBatch.DrawString(Util.SmallFont, tile.DebugInfo, Util.WorldToScreenPosition(relScreenPos), Color.Red);
                    }
                }
            }

            // draw target line if necessary
            if (InputManager.Instance.GetCurrentDomain() == InputManager.CommandDomain.Targeting)
            {
                var targetPos = EntityManager.GetComponent <TransformComponent>(Util.TargetIndicatorID).Position;
                var line      = Util.CurrentFloor.GetLine(playerPos, targetPos, true);

                if (line.Count > 1)
                {
                    line.RemoveAt(0); // don't draw square on player unless targeting self
                }

                foreach (var pos in line)
                {
                    DrawSprite(targetLine, pos - min);
                }

                DrawSprite(targetIndicator, targetPos - min);
            }

            spriteBatch.End(); //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

            graphics.SetRenderTarget(null);
        }
Esempio n. 45
0
        static void Main(string[] args)
        {
            Floor[] mapI        = new Floor[19];
            Floor[] map         = new Floor[60];
            player  p1          = new player();
            player  p2          = new player();
            int     mineCount   = 5;
            int     tunnelCount = 5;
            int     luckCount   = 5;
            int     pauseCount  = 5;

            //开始设置
            StartSetting(ref mineCount, ref tunnelCount, ref luckCount, ref pauseCount);


            //初始化地图
            int round = 1;

            InitializationMapO(map, mineCount, tunnelCount, luckCount, pauseCount);
            InitializationMapI(map, mapI);

            //初始化玩家
            p1.position.x = map[0].position.x;
            p2.position.x = map[30].position.x;
            p1.position.y = map[0].position.y;
            p2.position.y = map[30].position.y;
            p1.index      = 0;
            p2.index      = 30;
            p1.feet       = 0;
            p2.feet       = 0;
            p1.icon       = PLAYER_ICON;
            p2.icon       = PLAYER_ICON;
            p1.side       = "left";
            p2.side       = "right";
            p1.isLuck     = 0;
            p2.isLuck     = 0;

            PrintfUI();
            while (true)
            {
                bool jumpOut = false;
                ClearMainScreen();
                Console.SetCursorPosition(12, 8);
                Console.Write("请输入P1玩家名字:");
                p1.id   = Console.ReadLine();
                p1.isAI = false;

                while (true)
                {
                    Console.SetCursorPosition(7, 8);
                    Console.Write("欢迎,{0},请按下数字键选择是单人模式还是双人模式", p1.id);
                    Console.SetCursorPosition(12, 9);
                    Console.Write("1.单人模式,2.双人模式");

                    char key = Console.ReadKey(true).KeyChar;
                    switch (key)
                    {
                    case '1':
                        p2.id   = "AI";
                        p2.isAI = true;
                        jumpOut = true;
                        break;

                    case '2':
                        ClearMainScreen();
                        Console.SetCursorPosition(12, 8);
                        Console.Write("请输入P2玩家名字:");
                        p2.id   = Console.ReadLine();
                        p2.isAI = false;
                        jumpOut = true;
                        break;

                    default:
                        break;
                    }

                    if (jumpOut)
                    {
                        break;
                    }
                }

                if (jumpOut)
                {
                    break;
                }
            }

            ClearMainScreen();
            DrawMap(map);
            DrawMap(mapI);
            DrawPlayer(p1);
            DrawPlayer(p2);
            //begin
            while (true)
            {
                //画主屏幕



                //p1回合
                DrawRound(round, p1.id);
                IndicatePlayer(p1);
                DrawMap(map);
                DrawMap(mapI);
                DrawYellowPlayer(p1);
                DrawPlayer(p2);
                if (p1.isPause == false)
                {
                    p1.runPoint = ThrowD6(p1);
                    Thread.Sleep(2000);
                    Move(ref p1, map, mapI);
                    if (isSuccess(p1))
                    {
                        Thread.Sleep(1500);
                        break;
                    }
                    Thread.Sleep(1500);
                    if (p1.isLuck > 0)
                    {
                        p1.runPoint = 2;
                        ClearBottomScreen();
                        Console.SetCursorPosition(10, 21);
                        Console.Write("{0}获得幸运轮盘加成", p1.id);

                        Move(ref p1, map, mapI);
                        if (isSuccess(p1))
                        {
                            Thread.Sleep(1500);
                            break;
                        }
                        p1.isLuck--;
                        Thread.Sleep(1500);
                    }
                    Judge(ref p1, map, mapI);

                    DrawPlayer(p1);
                }
                else
                {
                    ClearBottomScreen();
                    Console.SetCursorPosition(10, 21);
                    Console.Write("{0}被暂停了", p1.id);
                    Thread.Sleep(2000);
                    DrawPlayer(p1);
                    p1.isPause = false;
                }

                round++;


                //p2回合
                DrawRound(round, p2.id);
                IndicatePlayer(p2);
                DrawMap(map);
                DrawMap(mapI);
                DrawYellowPlayer(p2);
                DrawPlayer(p1);
                if (p2.isPause == false)
                {
                    p2.runPoint = ThrowD6(p2);
                    Thread.Sleep(2000);
                    Move(ref p2, map, mapI);
                    if (isSuccess(p1))
                    {
                        Thread.Sleep(1500);
                        break;
                    }
                    Thread.Sleep(1500);
                    if (p2.isLuck > 0)
                    {
                        p2.runPoint = 2;
                        ClearBottomScreen();
                        Console.SetCursorPosition(10, 21);
                        Console.Write("{0}获得幸运轮盘加成", p2.id);

                        Move(ref p2, map, mapI);
                        if (isSuccess(p1))
                        {
                            Thread.Sleep(1500);
                            break;
                        }
                        p2.isLuck--;
                        Thread.Sleep(1500);
                    }
                    Judge(ref p2, map, mapI);
                    DrawPlayer(p2);
                }
                else
                {
                    ClearBottomScreen();
                    Console.SetCursorPosition(10, 21);
                    Console.Write("{0}被暂停了", p2.id);
                    Thread.Sleep(2000);
                    DrawPlayer(p2);
                    p2.isPause = false;
                }
                round++;
            }

            Console.SetCursorPosition(1, 25);
        }
Esempio n. 46
0
        /// <summary>
        /// Exports a CeilingAndFloor element to IFC.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="floor">The floor element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void ExportCeilingAndFloorElement(ExporterIFC exporterIFC, CeilingAndFloor floorElement, GeometryElement geometryElement,
                                                        ProductWrapper productWrapper)
        {
            if (geometryElement == null)
            {
                return;
            }

            // export parts or not
            bool exportParts = PartExporter.CanExportParts(floorElement);

            if (exportParts && !PartExporter.CanExportElementInPartExport(floorElement, floorElement.LevelId, false))
            {
                return;
            }

            string        ifcEnumType;
            IFCExportType exportType = ExporterUtil.GetExportType(exporterIFC, floorElement, out ifcEnumType);

            IFCFile file = exporterIFC.GetFile();
            IList <IFCAnyHandle> slabHnds        = new List <IFCAnyHandle>();
            IList <IFCAnyHandle> brepSlabHnds    = new List <IFCAnyHandle>();
            IList <IFCAnyHandle> nonBrepSlabHnds = new List <IFCAnyHandle>();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCTransformSetter transformSetter = IFCTransformSetter.Create())
                {
                    using (PlacementSetter placementSetter = PlacementSetter.Create(exporterIFC, floorElement))
                    {
                        IFCAnyHandle localPlacement = placementSetter.LocalPlacement;
                        IFCAnyHandle ownerHistory   = exporterIFC.GetOwnerHistoryHandle();
                        bool         exportedAsInternalExtrusion = false;

                        ElementId catId = CategoryUtil.GetSafeCategoryId(floorElement);

                        IList <IFCAnyHandle>             prodReps        = new List <IFCAnyHandle>();
                        IList <ShapeRepresentationType>  repTypes        = new List <ShapeRepresentationType>();
                        IList <IList <CurveLoop> >       extrusionLoops  = new List <IList <CurveLoop> >();
                        IList <IFCExtrusionCreationData> loopExtraParams = new List <IFCExtrusionCreationData>();
                        Plane floorPlane = GeometryUtil.CreateDefaultPlane();

                        IList <IFCAnyHandle> localPlacements = new List <IFCAnyHandle>();

                        if (!exportParts && (floorElement is Floor))
                        {
                            Floor floor = floorElement as Floor;

                            // First, try to use the ExtrusionAnalyzer for the limited cases it handles - 1 solid, no openings, end clippings only.
                            // Also limited to cases with line and arc boundaries.
                            //
                            SolidMeshGeometryInfo solidMeshInfo = GeometryUtil.GetSplitSolidMeshGeometry(geometryElement);
                            IList <Solid>         solids        = solidMeshInfo.GetSolids();
                            IList <Mesh>          meshes        = solidMeshInfo.GetMeshes();

                            if (solids.Count == 1 && meshes.Count == 0)
                            {
                                bool completelyClipped;
                                XYZ  floorExtrusionDirection = new XYZ(0, 0, -1);
                                XYZ  modelOrigin             = XYZ.Zero;

                                XYZ floorOrigin = floor.GetVerticalProjectionPoint(modelOrigin, FloorFace.Top);
                                if (floorOrigin == null)
                                {
                                    // GetVerticalProjectionPoint may return null if FloorFace.Top is an edited face that doesn't
                                    // go thruough te Revit model orgigin.  We'll try the midpoint of the bounding box instead.
                                    BoundingBoxXYZ boundingBox = floorElement.get_BoundingBox(null);
                                    modelOrigin = (boundingBox.Min + boundingBox.Max) / 2.0;
                                    floorOrigin = floor.GetVerticalProjectionPoint(modelOrigin, FloorFace.Top);
                                }

                                if (floorOrigin != null)
                                {
                                    XYZ   floorDir = floor.GetNormalAtVerticalProjectionPoint(floorOrigin, FloorFace.Top);
                                    Plane extrusionAnalyzerFloorPlane = new Plane(floorDir, floorOrigin);

                                    HandleAndData floorAndProperties =
                                        ExtrusionExporter.CreateExtrusionWithClippingAndProperties(exporterIFC, floorElement,
                                                                                                   catId, solids[0], extrusionAnalyzerFloorPlane, floorExtrusionDirection, null, out completelyClipped);
                                    if (completelyClipped)
                                    {
                                        return;
                                    }
                                    if (floorAndProperties.Handle != null)
                                    {
                                        IList <IFCAnyHandle> representations = new List <IFCAnyHandle>();
                                        representations.Add(floorAndProperties.Handle);
                                        IFCAnyHandle prodRep = IFCInstanceExporter.CreateProductDefinitionShape(file, null, null, representations);
                                        prodReps.Add(prodRep);
                                        repTypes.Add(ShapeRepresentationType.SweptSolid);

                                        if (floorAndProperties.Data != null)
                                        {
                                            loopExtraParams.Add(floorAndProperties.Data);
                                        }
                                    }
                                }
                            }
                        }

                        // Use internal routine as backup that handles openings.
                        if (prodReps.Count == 0)
                        {
                            exportedAsInternalExtrusion = ExporterIFCUtils.ExportSlabAsExtrusion(exporterIFC, floorElement,
                                                                                                 geometryElement, transformSetter, localPlacement, out localPlacements, out prodReps,
                                                                                                 out extrusionLoops, out loopExtraParams, floorPlane);
                            for (int ii = 0; ii < prodReps.Count; ii++)
                            {
                                // all are extrusions
                                repTypes.Add(ShapeRepresentationType.SweptSolid);
                            }
                        }

                        if (prodReps.Count == 0)
                        {
                            using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
                            {
                                BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
                                bodyExporterOptions.TessellationLevel = BodyExporter.GetTessellationLevel();
                                BodyData     bodyData;
                                IFCAnyHandle prodDefHnd = RepresentationUtil.CreateAppropriateProductDefinitionShape(exporterIFC,
                                                                                                                     floorElement, catId, geometryElement, bodyExporterOptions, null, ecData, out bodyData);
                                if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodDefHnd))
                                {
                                    ecData.ClearOpenings();
                                    return;
                                }

                                prodReps.Add(prodDefHnd);
                                repTypes.Add(bodyData.ShapeRepresentationType);
                            }
                        }

                        // Create the slab from either the extrusion or the BRep information.
                        string ifcGUID = GUIDUtil.CreateGUID(floorElement);

                        int numReps = exportParts ? 1 : prodReps.Count;

                        string entityType = null;

                        switch (exportType)
                        {
                        case IFCExportType.IfcFooting:
                            if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                            {
                                entityType = IFCValidateEntry.GetValidIFCType <Revit.IFC.Export.Toolkit.IFC4.IFCFootingType>(floorElement, ifcEnumType, null);
                            }
                            else
                            {
                                entityType = IFCValidateEntry.GetValidIFCType <IFCFootingType>(floorElement, ifcEnumType, null);
                            }
                            break;

                        case IFCExportType.IfcCovering:
                            entityType = IFCValidateEntry.GetValidIFCType <IFCCoveringType>(floorElement, ifcEnumType, "FLOORING");
                            break;

                        case IFCExportType.IfcRamp:
                            if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                            {
                                entityType = IFCValidateEntry.GetValidIFCType <Revit.IFC.Export.Toolkit.IFC4.IFCRampType>(floorElement, ifcEnumType, null);
                            }
                            else
                            {
                                entityType = IFCValidateEntry.GetValidIFCType <IFCRampType>(floorElement, ifcEnumType, null);
                            }
                            break;

                        default:
                            bool            isBaseSlab      = false;
                            AnalyticalModel analyticalModel = floorElement.GetAnalyticalModel();
                            if (analyticalModel != null)
                            {
                                AnalyzeAs slabFoundationType = analyticalModel.GetAnalyzeAs();
                                isBaseSlab = (slabFoundationType == AnalyzeAs.SlabOnGrade) || (slabFoundationType == AnalyzeAs.Mat);
                            }
                            entityType = IFCValidateEntry.GetValidIFCType <IFCSlabType>(floorElement, ifcEnumType, isBaseSlab ? "BASESLAB" : "FLOOR");
                            break;
                        }

                        for (int ii = 0; ii < numReps; ii++)
                        {
                            string ifcName        = NamingUtil.GetNameOverride(floorElement, NamingUtil.GetIFCNamePlusIndex(floorElement, ii == 0 ? -1 : ii + 1));
                            string ifcDescription = NamingUtil.GetDescriptionOverride(floorElement, null);
                            string ifcObjectType  = NamingUtil.GetObjectTypeOverride(floorElement, exporterIFC.GetFamilyName());
                            string ifcTag         = NamingUtil.GetTagOverride(floorElement, NamingUtil.CreateIFCElementId(floorElement));

                            string       currentGUID       = (ii == 0) ? ifcGUID : GUIDUtil.CreateGUID();
                            IFCAnyHandle localPlacementHnd = exportedAsInternalExtrusion ? localPlacements[ii] : localPlacement;

                            IFCAnyHandle slabHnd = null;

                            // TODO: replace with CreateGenericBuildingElement.
                            switch (exportType)
                            {
                            case IFCExportType.IfcFooting:
                                slabHnd = IFCInstanceExporter.CreateFooting(file, currentGUID, ownerHistory, ifcName,
                                                                            ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii],
                                                                            ifcTag, entityType);
                                break;

                            case IFCExportType.IfcCovering:
                                slabHnd = IFCInstanceExporter.CreateCovering(file, currentGUID, ownerHistory, ifcName,
                                                                             ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii],
                                                                             ifcTag, entityType);
                                break;

                            case IFCExportType.IfcRamp:
                                slabHnd = IFCInstanceExporter.CreateRamp(file, currentGUID, ownerHistory, ifcName,
                                                                         ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii],
                                                                         ifcTag, entityType);
                                break;

                            default:
                                slabHnd = IFCInstanceExporter.CreateSlab(file, currentGUID, ownerHistory, ifcName,
                                                                         ifcDescription, ifcObjectType, localPlacementHnd, exportParts ? null : prodReps[ii],
                                                                         ifcTag, entityType);
                                break;
                            }

                            if (IFCAnyHandleUtil.IsNullOrHasNoValue(slabHnd))
                            {
                                return;
                            }

                            if (exportParts)
                            {
                                PartExporter.ExportHostPart(exporterIFC, floorElement, slabHnd, productWrapper, placementSetter, localPlacementHnd, null);
                            }

                            slabHnds.Add(slabHnd);

                            if (!exportParts)
                            {
                                if (repTypes[ii] == ShapeRepresentationType.Brep)
                                {
                                    brepSlabHnds.Add(slabHnd);
                                }
                                else
                                {
                                    nonBrepSlabHnds.Add(slabHnd);
                                }
                            }
                        }

                        for (int ii = 0; ii < numReps; ii++)
                        {
                            IFCExtrusionCreationData loopExtraParam = ii < loopExtraParams.Count ? loopExtraParams[ii] : null;
                            productWrapper.AddElement(floorElement, slabHnds[ii], placementSetter, loopExtraParam, true);
                        }

                        if (exportedAsInternalExtrusion)
                        {
                            ExporterIFCUtils.ExportExtrudedSlabOpenings(exporterIFC, floorElement, placementSetter.LevelInfo,
                                                                        localPlacements[0], slabHnds, extrusionLoops, floorPlane, productWrapper.ToNative());
                        }
                    }

                    if (!exportParts)
                    {
                        if (nonBrepSlabHnds.Count > 0)
                        {
                            HostObjectExporter.ExportHostObjectMaterials(exporterIFC, floorElement, nonBrepSlabHnds,
                                                                         geometryElement, productWrapper, ElementId.InvalidElementId, Toolkit.IFCLayerSetDirection.Axis3, false);
                        }
                        if (brepSlabHnds.Count > 0)
                        {
                            HostObjectExporter.ExportHostObjectMaterials(exporterIFC, floorElement, brepSlabHnds,
                                                                         geometryElement, productWrapper, ElementId.InvalidElementId, Toolkit.IFCLayerSetDirection.Axis3, true);
                        }
                    }
                }
                tr.Commit();

                return;
            }
        }
Esempio n. 47
0
 public Elevator()
 {
     CurrentFloor    = Floor.G;
     eventIsOccupied = new ManualResetEvent(false);
     CurrentAgent    = null;
 }
Esempio n. 48
0
 /// <summary>
 /// 画地块
 /// </summary>
 /// <param name="cell"></param>
 static void DrawFloor(Floor cell)
 {
     Console.SetCursorPosition(cell.position.x * 2, cell.position.y);
     Console.Write(cell.icon);
 }
Esempio n. 49
0
    /// <summary>
    /// Draws floor outlines of building
    /// </summary>
    private IEnumerator DrawBuilding(Building building)
    {
        GameObject buildingObject = new GameObject(building.Name);

        buildingObject.transform.parent = _campusParent;
        building.RenderedModel          = buildingObject.transform;
        List <Transform> floorObjects = new List <Transform>();

        foreach (KeyValuePair <int, Floor> pair in building.Floors)
        {
            Floor floor = pair.Value;
            WWW   www   = new WWW(string.Format(REST_FLOOROUTLINE, floor.Id));
            yield return(www);

            string wwwText = www.text;
            if (_isUsingBackup)
            {
                string json;
                if (_mazemapBackup.Campuses[CampusId].Floors.TryGetValue(floor.Id, out json))
                {
                    wwwText = json;
                }
                else
                {
                    yield break;
                }
            }

            GameObject floorObject = DrawFloorOutlines(wwwText);
            floorObject.SetActive(false);
            floorObject.name = floor.Name;
            floorObjects.Add(floorObject.transform);

            /* TODO: Implement again when we using individual building measurements
             * bool exists = false;
             * if (_mazeMapMeasurements.GetCampusMeasurement(CampusId) != null)
             *  if (_mazeMapMeasurements.GetCampusMeasurement(CampusId).GetBuildingMeasurement(building.BuildingId) != null)
             *  {
             *      exists = true;
             *      floorObject.transform.position = floorObject.transform.position +
             *          new Vector3(0, _mazeMapMeasurements.GetCampusMeasurement(CampusId).GetBuildingMeasurement(building.BuildingId).FloorHeights[floor.FloorIndex], 0);
             *  }
             * if (!exists)
             */
            float y = 0;
            if (floor.FloorIndex >= 1)
            {
                y = floor.FloorIndex * FloorHeightAboveGround;
            }
            if (floor.FloorIndex < 1)
            {
                y = floor.FloorIndex * FloorHeightBelowGround;
            }
            floorObject.transform.position = floorObject.transform.position + new Vector3(0, y, 0);
            floor.RenderedModel            = floorObject.transform;

            if (!_floorsByZ.ContainsKey(floor.FloorIndex))
            {
                _floorsByZ.Add(floor.FloorIndex, new List <Floor>());
                _zLayerActive.Add(floor.FloorIndex, false);
            }
            _floorsByZ[floor.FloorIndex].Add(floor);

            if (_shouldBackupMazemapData)
            {
                _mazemapBackup.Campuses[CampusId].Floors.Add(pair.Key, wwwText);
            }
        }

        foreach (Transform t in floorObjects)
        {
            t.SetParent(buildingObject.transform, true);
        }

        //RenderBuilding(buildingObject);
        CenterParentOnChildren(buildingObject.transform);
        StartCoroutine(DrawRoomsInBuilding(building));
    }
Esempio n. 50
0
 public override void SelectBusiness(Business business)
 {
     Floor = business?.Floor;
 }
Esempio n. 51
0
    public bool Move(MoveDir forward, bool Pushed = false)
    {
        if (DelayRun != null && !Pushed)
        {
            return(false);
        }
        GameMap map = _Map;

        InputListener.isMove = false;

        Location location = Location;

        Vector3 oldPS = transform.position;

        Debug.Log("oldPS is " + oldPS);
        switch (forward)
        {
        //上
        case MoveDir.Up:
            if (VForbid && !Pushed)
            {
                return(false);
            }
            location.y += 1;
            break;

        //左
        case MoveDir.Left:
            if (HForbid && !Pushed)
            {
                return(false);
            }
            location.x -= 1;
            break;

        //下
        case MoveDir.Down:
            if (VForbid && !Pushed)
            {
                return(false);
            }
            location.y -= 1;
            break;

        //右
        case MoveDir.Right:
            if (HForbid && !Pushed)
            {
                return(false);
            }
            location.x += 1;
            break;

        default:
            break;
        }
        ;
        Floor floor = _Map.GetFloorByLocation(location);

        if (floor == null)
        {
            return(false);
        }
        else if (floor.Type == FloorType.Jamed)
        {
            return(false);
        }
        //检查下一步有没有角色
        foreach (PlayerGameObj playerObj in _Map.PlayerList)
        {
            if (playerObj != this && playerObj.CurFloorIdx == _Map.GetIdxByLocation(location))
            {
                if (playerObj.Move(forward, true))
                {
                    _MoveEnd(location);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        _MoveEnd(location);
        return(true);
    }
Esempio n. 52
0
        public void DrawArena(RLConsole console)
        {
            // Use RogueSharp to calculate the current field-of-view for the player
            var position = Floor.Player.TryGetPosition();

            Floor.FloorMap.ComputeFov(position.X, position.Y, 50, true);

            foreach (var cell in Floor.FloorMap.GetAllCells())
            {
                // When a Cell is in the field-of-view set it to a brighter color
                if (cell.IsInFov)
                {
                    Floor.FloorMap.SetCellProperties(cell.X, cell.Y, cell.IsTransparent, cell.IsWalkable, true);
                    if (cell.IsWalkable)
                    {
                        console.Set(cell.X, cell.Y, RLColor.Gray, null, '.');
                    }
                    else
                    {
                        console.Set(cell.X, cell.Y, RLColor.LightGray, null, '#');
                    }
                }
                // If the Cell is not in the field-of-view but has been explored set it darker
                else
                {
                    if (cell.IsWalkable)
                    {
                        console.Set(cell.X, cell.Y, new RLColor(30, 30, 30), null, '.');
                    }
                    else
                    {
                        console.Set(cell.X, cell.Y, RLColor.Gray, null, '#');
                    }
                }
            }

            // Draw enemies, alert + scan radii
            List <RogueSharp.Cell> alertCells = new List <RogueSharp.Cell>();
            List <RogueSharp.Cell> scanCells  = new List <RogueSharp.Cell>();

            foreach (var e in Floor.InspectMapEntities().Where(e => e != Floor.Player))
            {
                var entityPosition = e.TryGetPosition();
                if (e.TryGetDestroyed())
                {
                    console.Set(entityPosition.X, entityPosition.Y, RLColor.Gray, null, 'D');
                }
                else
                {
                    console.Set(entityPosition.X, entityPosition.Y, RLColor.Red, null, 'E');

                    var componentAI = e.GetComponentOfType <Component_AI>();
                    if (componentAI != null)
                    {
                        var infoCells = componentAI.AlertCells(this.Floor);
                        scanCells.AddRange(infoCells.ScanCells);
                        alertCells.AddRange(infoCells.AlertCells);
                    }
                }
            }
            foreach (var cell in scanCells)
            {
                console.SetBackColor(cell.X, cell.Y, RLColor.LightBlue);
            }
            foreach (var cell in alertCells)
            {
                console.SetBackColor(cell.X, cell.Y, RLColor.LightRed);
            }

            // Draw player
            console.Set(position.X, position.Y, RLColor.Green, null, '@');

            // Highlight examined
            if (this.examineMenu.Examining)
            {
                var examinedPostion = this.examineMenu.ExaminedEntity.TryGetPosition();
                console.SetBackColor(examinedPostion.X, examinedPostion.Y, RLColor.Yellow);
            }

            // Highlight targeting
            if (this.targetMenu.Targeting)
            {
                var playerPosition = Floor.Player.TryGetPosition();
                // TODO: Artemis is crying
                var cellsInRange = Floor.CellsInRadius(playerPosition.X, playerPosition.Y,
                                                       this.inventoryMenu.SelectedItem.GetComponentOfType <Component_Usable>().TargetRange);
                foreach (RogueSharp.Cell cell in cellsInRange)
                {
                    if (cell.IsInFov && cell.IsWalkable)
                    {
                        console.SetBackColor(cell.X, cell.Y, RLColor.LightGreen);
                    }
                }

                console.SetBackColor(this.targetMenu.X, this.targetMenu.Y, RLColor.Green);
            }

            // Draw commands
            foreach (var command in dungeon.ExecutedCommands)
            {
                if (command is GameEvent_PrepareAttack)
                {
                    var cmd         = (GameEvent_PrepareAttack)command;
                    var attackerPos = cmd.CommandEntity.TryGetPosition();
                    var targetPos   = cmd.Target.TryGetPosition();
                    var lineCells   = this.Floor.FloorMap.GetCellsAlongLine(attackerPos.X, attackerPos.Y, targetPos.X,
                                                                            targetPos.Y);
                    foreach (var cell in lineCells)
                    {
                        console.SetBackColor(cell.X, cell.Y, RLColor.LightRed);
                    }
                }
            }
            dungeon.ClearExecutedCommands();
        }
Esempio n. 53
0
 public CreateDividedParts(Floor floor, List <Line> boundingSquare)
 {
     this.Floor          = floor;
     this.BoundingSquare = boundingSquare;
 }
Esempio n. 54
0
 // Use this for initialization
 void Start()
 {
     floor          = GameObject.FindGameObjectWithTag("Floor").GetComponent <Floor>();
     timeUntilCheck = checkRate;
 }
Esempio n. 55
0
 public void Init()
 {
     floor = new Floor();
 }
Esempio n. 56
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="floor">Selected floor</param>
 /// <param name="commandData">ExternalCommandData</param>
 public ProfileFloor(Floor floor, ExternalCommandData commandData)
     : base(floor, commandData)
 {
     m_data = floor;
 }
Esempio n. 57
0
        private static List <Face3D> Profiles_Floor(this Floor floor)
        {
            List <Face3D> face3Ds = TopProfiles(floor);

            return(face3Ds);
        }
Esempio n. 58
0
 public FloorProperties(Document document, Floor floor)
 {
     m_doc   = document;
     m_floor = floor;
 }
Esempio n. 59
0
 public Tile NorthEast() => Floor.GetTile(ref _northEast, Location.Shift(1, 0, 1));
Esempio n. 60
0
    private void DetectClickOnTiles()
    {
        if (!TouchHelpers.IsTouchingOrClickingOverUI())
        {
            Ray          ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity);

            if (hit)
            {
                DesactiveAllMenus();

                if (hit.transform.tag == "floor")
                {
                    if (hit.transform.gameObject == selectedFloor)
                    {
                        DeselectCurrentFloor();
                        return;
                    }

                    if (selectedFloor != null)
                    {
                        if (typeOfConnectionToCreate != null)
                        {
                            Floor current_floor = CurrentSelectedFloor();
                            Floor another_floor = hit.transform.GetComponent <Floor>();

                            if (current_floor.IsHoldingSomething() &&
                                another_floor.IsHoldingSomething() &&
                                !machineController.IsThereConnectionBetween(current_floor.objectHolded,
                                                                            another_floor.objectHolded))
                            {
                                CreateConnectionBetweenMachinesOn(selectedFloor,
                                                                  hit.transform.gameObject,
                                                                  ConnectionPreFabByType(typeOfConnectionToCreate),
                                                                  ConnectionsOnMachines().Count);
                                ConnectionModeOff();
                                DeselectCurrentFloor();
                                return;
                            }
                        }

                        DeselectCurrentFloor();
                    }

                    SelectFloor(hit.transform.gameObject);

                    if (IsCurrentSelectedFloorHoldingSomething())
                    {
                        switch (selectedFloor.GetComponent <Floor>().objectHolded.tag)
                        {
                        case "machine":
                        {
                            ActiveMachineEditorMenu(true);
                            break;
                        }

                        case "decoration":
                        {
                            ActiveDecorationEditorMenu(true);
                            break;
                        }
                        }
                    }
                    else
                    {
                        ActiveFloorEditorMenu(true);
                    }
                }
                else
                {
                    DeselectCurrentFloor();
                }
            }
        }
    }