Inheritance: MonoBehaviour
示例#1
0
 public BallServer(Vector2 initialPosition, Vector2 initVelocity, int screenHeight)
 {
     Position = initialPosition;
     Velocity = initVelocity;
     height   = screenHeight;
     Outside  = Outside.None;
 }
示例#2
0
        public void TestPart1()
        {
            Room            diningRoom = new Room("Dining Room", "a crystal chandelier");
            RoomWithDoor    kitchen    = new RoomWithDoor("Kitchen", "stainless steel appliances", "screen door");
            RoomWithDoor    livingRoom = new RoomWithDoor("Living Room", "an antique carpet", "an oak door with a brass knob");
            Outside         garden     = new Outside("Garden", false);
            OutsideWithDoor frontYard  = new OutsideWithDoor("Front Yard", false, "an oak door with a brass knob");
            OutsideWithDoor backYard   = new OutsideWithDoor("Back Yard", true, "screen door");

            diningRoom.Exits = new Location[] { livingRoom, kitchen };

            kitchen.Exits        = new Location[] { diningRoom };
            kitchen.DoorLocation = backYard;

            livingRoom.Exits        = new Location[] { diningRoom };
            livingRoom.DoorLocation = frontYard;

            garden.Exits = new Location[] { backYard, frontYard };

            frontYard.Exits        = new Location[] { garden, backYard };
            frontYard.DoorLocation = livingRoom;

            backYard.Exits        = new Location[] { garden, frontYard };
            backYard.DoorLocation = kitchen;
        }
示例#3
0
        private void InitializeRoom()
        {
            diningRoom = new Room("Dining Room", "a crystal chandelier");
            kitchen    = new RoomWithDoor("Kitchen", "stainless steel appliances", "screen door");
            livingRoom = new RoomWithDoor("Living Room", "an antique carpet", "an oak door with a brass knob");
            garden     = new Outside("Garden", false);
            frontYard  = new OutsideWithDoor("Front Yard", false, "an oak door with a brass knob");
            backYard   = new OutsideWithDoor("Back Yard", true, "screen door");

            diningRoom.Exits = new Location[] { livingRoom, kitchen };

            kitchen.Exits        = new Location[] { diningRoom };
            kitchen.DoorLocation = backYard;

            livingRoom.Exits        = new Location[] { diningRoom };
            livingRoom.DoorLocation = frontYard;

            garden.Exits = new Location[] { backYard, frontYard };

            frontYard.Exits        = new Location[] { garden, backYard };
            frontYard.DoorLocation = livingRoom;

            backYard.Exits        = new Location[] { garden, frontYard };
            backYard.DoorLocation = kitchen;

            houseMove = new HouseMove(diningRoom);
        }
        public bool Equals(IPolygon2D other)
        {
            var poly = other as Polygon2DWithHoles;

            if (poly == null)
            {
                return(false);
            }

            if (!Outside.Equals(poly.Outside))
            {
                return(false);
            }
            if (Holes.Count != poly.Holes.Count)
            {
                return(false);
            }

            var holes      = Holes.ToList();
            var otherHoles = poly.Holes.ToList();

            for (var i = 0; i < holes.Count; i++)
            {
                if (!holes[i].Equals(otherHoles[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
    public static void Main(string[] args)
    {
        Outside outside = new Outside();

        Outside.Inside obj = new Outside.Inside(outside);
        obj.Print();
    }
示例#6
0
        private void 建立所有區域()
        {
            客廳 = new RoomWithDoor("豪華的客廳", "65吋大電視,豪華大沙發", "可以通往前院的門");
            餐廳 = new Room("溫馨的餐廳", "大餐桌,烤箱,大冰箱");
            廚房 = new RoomWithDoor("實用的廚房", "爐子,微波爐,洗碗機", "可以通往後院的門");
            前院 = new OutsideWithDoor("前院", true, "可以回客廳的門");
            後院 = new OutsideWithDoor("後院", true, "可以回廚房的門");
            花圃 = new Outside("美麗的花園", true);



            客廳.Exits        = new Location[] { 前院, 餐廳 };
            客廳.DoorLocation = 前院;
            餐廳.Exits        = new Location[] { 客廳, 廚房 };
            廚房.Exits        = new Location[] { 後院, 餐廳 };
            廚房.DoorLocation = 後院;

            前院.Exits        = new Location[] { 客廳, 花圃 };
            前院.DoorLocation = 客廳;

            後院.Exits        = new Location[] { 廚房, 花圃 };
            後院.DoorLocation = 廚房;

            花圃.Exits = new Location[] { 前院, 後院 };
        }
示例#7
0
            public void Check()
            {
                if (Outside.RequestToOpen)
                {
                    if (!Inside.IsOpen && !Inside.IsClosing)
                    {
                        Outside.Open();
                    }

                    if (Inside.IsOpen && !Inside.IsClosing)
                    {
                        Inside.Close();
                        Outside.Close();
                    }
                }

                if (Inside.RequestToOpen)
                {
                    if (!Outside.IsOpen && !Outside.IsClosing)
                    {
                        Inside.Open();
                    }

                    if (Outside.IsOpen && !Outside.IsClosing)
                    {
                        Outside.Close();
                        Inside.Close();
                    }
                }
            }
 public Inside(Outside outer)
 {
     if (outer == null)
     {
         throw new ArgumentNullException("outer");
     }
     _outer = outer;
 }
 /// <summary>
 /// Shifts all polygon points such that the given point lies at origin.
 /// </summary>
 /// <param name="a_point"></param>
 public void ShiftToOrigin(Vector2 a_point)
 {
     Outside.ShiftToOrigin(a_point);
     foreach (var h in m_holes)
     {
         h.ShiftToOrigin(a_point);
     }
 }
示例#10
0
 private void setOutsideStory()
 {
     outStory        = new Outside(names, dialogs, playerName);
     names           = outStory.getNames();
     dialogs         = outStory.getDialogs();
     backdrop.sprite = (Sprite)Resources.Load("Tutorial/street", typeof(Sprite));
     newStory        = "Bakeshop1";
 }
 public void Reverse()
 {
     Outside.Reverse();
     foreach (var p in m_holes)
     {
         p.Reverse();
     }
 }
        private void 建立所有區域()
        {
            //create first floor
            //客廳 = new RoomWithDoor("豪華的客廳", "65吋大電視,豪華大沙發", "可以通往前院的門");
            //建立有樓梯的客廳
            客廳 = new RoomWithDoorAndStair("豪華的客廳", "65吋大電視,豪華大沙發", "可以通往前院的門", "可以通往二樓的樓梯");
            餐廳 = new Room("溫馨的餐廳","大餐桌,烤箱,大冰箱");
            廚房 = new RoomWithDoor("實用的廚房", "爐子,微波爐,洗碗機", "可以通往後院的門");
            前院 = new OutsideWithDoor("前院", true, "可以回客廳的門");
            後院 = new OutsideWithDoor("後院", true, "可以回廚房的門");
            花圃 = new Outside("美麗的花園",true);

            //create second floor
            主臥室 = new RoomWithDoor("豪華的主臥室", "65吋大電視,豪華大床", "可以通往前陽台的門");
            主臥浴室 = new Room("主臥的浴室", "大浴缸");
            客人浴室 = new Room("客人的浴室", "淋浴間");
            書房 = new Room("工作用書房", "電腦很多台");
            前陽台 = new OutsideWithDoor("前陽台", true, "可以回主臥室的門");
            後陽台 = new OutsideWithDoor("後陽台", true, "可以回走道的門");
            空中花園 = new Outside("美麗的空中花園", true);
            //走道 = new AisleWithDoor("二樓走道", "壁掛繪畫作裝飾", "可以通往後陽台的門");
            //建立有樓梯的走道
            走道 = new AisleWithDoorAndStair("二樓走道", "壁掛繪畫作裝飾", "可以通往後陽台的門", "可以通往一樓的樓梯");

            //一樓布局
            客廳.Exits = new Location[] { 前院, 餐廳, 走道 };
            客廳.DoorLocation = 前院;
            客廳.StairLocation = 走道;
            餐廳.Exits = new Location[] { 客廳, 廚房 };
            廚房.Exits = new Location[] { 後院, 餐廳 };
            廚房.DoorLocation = 後院;

            前院.Exits = new Location[] { 客廳, 花圃 };
            前院.DoorLocation = 客廳;

            後院.Exits = new Location[] { 廚房, 花圃 };
            後院.DoorLocation = 廚房;

            花圃.Exits = new Location[] { 前院, 後院 };

            //二樓布局
            主臥室.Exits = new Location[] { 前陽台, 主臥浴室, 走道 };
            主臥室.DoorLocation = 前陽台;
            主臥浴室.Exits = new Location[] { 主臥室 };
            書房.Exits = new Location[] { 走道 };
            客人浴室.Exits = new Location[] { 走道 };
            走道.Exits = new Location[] { 主臥室, 客廳, 書房, 客人浴室, 後陽台 };
            走道.DoorLocation = 後陽台;
            走道.StairLocation = 客廳;

            前陽台.Exits = new Location[] { 主臥室, 空中花園 };
            前陽台.DoorLocation = 主臥室;

            後陽台.Exits = new Location[] { 走道, 空中花園 };
            後陽台.DoorLocation = 走道;

            空中花園.Exits = new Location[] { 前陽台, 後陽台 };
        }
示例#13
0
        /// <summary>
        /// リムーブ 引数のカードを「OutSide」に移動する。
        /// </summary>
        /// <param name="card">リムーブするカード</param>
        public void Remove(Card card)
        {
            if (!CanRemove(card))
            {
                throw new InvalidOperationException();
            }

            Dictionary[card] = new Outside();
        }
 public void Clear()
 {
     Outside.Clear();
     foreach (var p in m_holes)
     {
         p.Clear();
     }
     m_holes.Clear();
 }
示例#15
0
 public override void Initialize(AreaRoom parent, AreaAction child)
 {
     base.Initialize(parent, child);
     room = parent as Outside;
     if (!room)
     {
         Debug.LogError("Action is placed in the wrong room! [Not outside]");
     }
 }
示例#16
0
        static void Main(string[] args)
        {
            Outside.Inside inside = new Outside.Inside();
            inside.Print();

            Outside o = new Outside();

            o.Display();
        }
示例#17
0
        void CreateDatabase()
        {
            using (var reader = new StreamReader(@"C:\Users\Erik\Desktop\DB Inlämmning\TemperaturData.csv"))
            {
                List <TempData> insideList  = new List <TempData>();
                List <TempData> outsideList = new List <TempData>();


                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(',');

                    if (values[1].Equals("Inne"))
                    {
                        string temp = values[2].Replace('.', ',');

                        TempData tempData = new TempData(DateTime.Parse(values[0]), float.Parse(temp), int.Parse(values[3]));

                        insideList.Add(tempData);
                    }
                    else if (values[1].Equals("Ute"))
                    {
                        string temp = values[2].Replace('.', ',');

                        TempData tempData = new TempData(DateTime.Parse(values[0]), float.Parse(temp), int.Parse(values[3]));

                        outsideList.Add(tempData);
                    }
                }

                using (var context = new EFContext())
                {
                    foreach (TempData tempData in outsideList)
                    {
                        Outside toAdd = new Outside();
                        toAdd.Date        = tempData.date;
                        toAdd.Moisture    = tempData.moisture;
                        toAdd.Temperature = tempData.temperature;

                        context.Add(toAdd);
                    }

                    foreach (TempData tempData in insideList)
                    {
                        Inside toAdd = new Inside();
                        toAdd.Date        = tempData.date;
                        toAdd.Moisture    = tempData.moisture;
                        toAdd.Temperature = tempData.temperature;

                        context.Add(toAdd);
                    }

                    context.SaveChanges();
                }
            }
        }
        public bool IsClockwise()
        {
            bool ret = Outside.IsClockwise();

            foreach (var p in m_holes)
            {
                ret &= p.IsClockwise();                         // holes are also clockwise (not counterclockwise)
            }
            return(ret);
        }
示例#19
0
        /// <summary>
        /// リムーブ可否 引数の2枚のカードを「OutSide」に移動できるか。
        /// </summary>
        /// <param name="firstCard"></param>
        /// <param name="secondCard"></param>
        public void Remove(Card firstCard, Card secondCard)
        {
            if (!CanRemove(firstCard, secondCard))
            {
                throw new InvalidOperationException();
            }

            Dictionary[firstCard]  = new Outside();
            Dictionary[secondCard] = new Outside();
        }
示例#20
0
    public static void Main()
    {
        Outside out1 = new Outside();

        out1.Wyswietl();
        Outside.Inside ins1 = new Outside.Inside();
        ins1.Ustaw(100); //wyjątek NullReferenceException
        out1.Wyswietl();
        Console.ReadKey();
    }
示例#21
0
        public virtual async Task PlayerIsDead()
        {
            await TextArea.PrintLine();

            await TextArea.PrintLine();

            await TextArea.PrintLine("            You died!");

            await TextArea.PrintLine();

            await TextArea.PrintLine();

            SoundMan.PlaySound(LotaSound.VeryBad);

            await GameControl.FlashHPWhileSound(XleColor.Red, XleColor.Yellow);

            await LoadOutsideMap();

            IOutsideExtender extender = (IOutsideExtender)GameState.MapExtender;
            Outside          map      = (Outside)extender.TheMap;

            extender.CancelEncounter();

            TerrainType t;

            do
            {
                Player.X = Random.Next(Map.Width);
                Player.Y = Random.Next(Map.Height);

                t = map.TerrainAt(Player.X, Player.Y);
            } while (t != TerrainType.Grass && t != TerrainType.Forest);

            Player.Rafts.Clear();

            Player.HP                = Player.MaxHP;
            Player.Food              = 30 + Random.Next(10);
            Player.Gold              = 25 + Random.Next(30);
            Player.BoardedRaft       = null;
            Player.LastAttackedMapID = 0;

            while (SoundMan.IsPlaying(LotaSound.VeryBad))
            {
                await GameControl.WaitAsync(40);
            }

            await TextArea.PrintLine("The powers of the museum");

            await TextArea.PrintLine("resurrect you from the grave!");

            await TextArea.PrintLine();

            await GameControl.PlaySoundWait(LotaSound.VeryGood);
        }
        private void AnfrageSpeichern(bool annehmen)
        {
            //Dialog vorbereiten
            var w       = new InfoAnRednerUndKoordinatorWindow();
            var data    = (InfoAnRednerUndKoordinatorViewModel)w.DataContext;
            var buchung = new Outside
            {
                Ältester    = SelectedRedner,
                Versammlung = SelectedVersammlung,
                Kw          = Kalenderwoche,
                Reason      = OutsideReason.Talk,
                Vortrag     = SelectedVortrag
            };

            var doppelbuchung = DataContainer.ExternerPlan.Any(x => x.Ältester == SelectedRedner && x.Kw == Kalenderwoche) ||
                                DataContainer.MeinPlan.Where(x => x.Kw == Kalenderwoche && x.Status == EventStatus.Zugesagt).Cast <Invitation>().Any(x => x.Ältester == SelectedRedner);

            if (doppelbuchung)
            {
                if (ThemedMessageBox.Show("Warnung", "Für diesen Redner gibt es an dem Datum schon eine Buchung. Trotzdem Buchung speichern?", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning) == System.Windows.MessageBoxResult.No)
                {
                    return;
                }
            }

            //Anfrage akzeptieren
            if (annehmen)
            {
                data.Titel = "Buchung bestätigen";
                data.MailTextKoordinator = Templates.GetMailTextAnnehmenKoordinator(buchung);
                data.MailTextRedner      = Templates.GetMailTextAnnehmenRedner(buchung);
                w.ShowDialog();

                if (data.Speichern)
                {
                    DataContainer.ExternerPlan.Add(buchung);
                    ActivityLog.AddActivity.Outside(buchung, data.MailTextKoordinator, data.MailTextRedner, true);
                }
            }
            //Anfrage ablehnen
            else
            {
                data.Titel = "Anfrage ablehnen";
                data.MailTextKoordinator = Templates.GetMailTextAblehnenKoordinator(buchung);
                data.MailTextRedner      = null;
                w.ShowDialog();

                if (data.Speichern)
                {
                    ActivityLog.AddActivity.Outside(buchung, data.MailTextKoordinator, null, false);
                }
            }
        }
示例#23
0
文件: DayTest.cs 项目: RxnDbr/PI_Mars
        public void isOutsideTest()
        {
            Future   target = CreateDay(); // TODO: Initialize to an appropriate value
            Activity act    = new Outside(10, 15, target.Map_hq, "exploration");

            target.addActivity(act);
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;

            actual = target.isOutside();
            Assert.AreEqual(expected, actual);
        }
        public bool ContainsInside(Vector2 a_pos)
        {
            foreach (var hole in m_holes)
            {
                if (hole.ContainsInside(a_pos))
                {
                    return(false);
                }
            }

            return(Outside.ContainsInside(a_pos));
        }
示例#25
0
文件: Future.cs 项目: RxnDbr/PI_Mars
    public void modifyHoursActivity(Activity prevActivity, int newStart, int newEnd)
    {
        //we have to create a new activity and not only update the previous one not to have problems with sortActivity
        Activity newActivity;

        if (prevActivity is Inside) { newActivity = new Inside(newStart, newEnd, prevActivity.Place, prevActivity.Type); }
        else { newActivity = new Outside(newStart, newEnd, prevActivity.Place, prevActivity.Type); }
        newActivity.Description = prevActivity.Description;
        newActivity.L_astronaut = prevActivity.L_astronaut;

        rmActivity(prevActivity);
        addActivity(newActivity);
    }
示例#26
0
        // constructor
        public StripFSM()
        {
            itsStartingSlashState  = new StartingSlash();
            itsOutsideState        = new Outside();
            itsStarAfterSlashState = new StarAfterSlash();
            itsSecondSlashState    = new SecondSlash();
            itsStartingStarState   = new StartingStar();

            itsState = itsOutsideState;

            // Entry functions for: outside
            OutsideIn();
        }
示例#27
0
            private bool GenerateOutsider(int index, out Outside outsider)
            {
                Vector3i triangle      = m_triangles[index];
                int      neighborCount = 0;
                bool     xy            = true;
                bool     yz            = true;
                bool     zx            = true;

                outsider = default;
                foreach (int checkIndex in m_indexes)
                {
                    if (checkIndex == index)
                    {
                        continue;
                    }
                    Vector3i check = m_triangles[checkIndex];
                    if (check.ContainsValue(triangle.X))
                    {
                        if (check.ContainsValue(triangle.Y))
                        {
                            xy = false;
                            if (++neighborCount == 3)
                            {
                                return(false);
                            }
                        }
                        else if (check.ContainsValue(triangle.Z))
                        {
                            zx = false;
                            if (++neighborCount == 3)
                            {
                                return(false);
                            }
                        }
                    }
                    else if (check.ContainsValue(triangle.Y) && (check.ContainsValue(triangle.Z)))
                    {
                        yz = false;
                        if (++neighborCount == 3)
                        {
                            return(false);
                        }
                    }
                }
                int vertex = xy ? (zx ? 2 : 0) : (yz ? 1 : 2);

                outsider = new Outside(index, vertex);
                return(true);
            }
示例#28
0
            public void GenerateOutline()
            {
                List <int> outline       = new List <int>();
                Outside    outsider      = m_outsiders[0];
                Vector3i   tri           = m_triangles[outsider.Triangle];
                int        first         = tri.GetValueByMember(outsider.Member);
                int        second        = tri.GetValueByMember(outsider.Member + 1);
                int        startTriIndex = outsider.Triangle;

                outline.Add(first);
                outline.Add(second);

                Vector3i lastTri      = tri;
                int      lastMember   = outsider.Member + 1;
                int      lastVertex   = lastTri.GetValueByMember(outsider.Member);
                int      lastTriIndex = outsider.Triangle;

                while (true)
                {
                    if (GetNextOutsideInfo(lastTri, lastMember, out outsider))
                    {
                        lastTri      = m_triangles[outsider.Triangle];
                        lastMember   = outsider.Member + 1;
                        lastVertex   = lastTri.GetValueByMember(outsider.Member);
                        lastTriIndex = outsider.Triangle;
                    }
                    else
                    {
                        lastMember++;
                        if (lastTri.GetValueByMember(lastMember) == lastVertex)
                        {
                            if (lastVertex != first)
                            {
                                break;
                            }
                        }
                    }

                    int nextVertex = lastTri.GetValueByMember(lastMember);
                    if (nextVertex == first)
                    {
                        break;
                    }

                    outline.Add(nextVertex);
                }

                GeneratedOutline = outline;
            }
示例#29
0
 private void SetOutside()
 {
     if (Position.X + 2 * RADIUS < 0)
     {
         Outside = Outside.Left;
     }
     else if (Position.X > Constants.SCREEN_WIDTH)
     {
         Outside = Outside.Right;
     }
     else
     {
         Outside = Outside.None;
     }
 }
 public Vector2?Prev(Vector2 pos)
 {
     if (Outside.ContainsVertex(pos))
     {
         return(Outside.Prev(pos));
     }
     foreach (var p in m_holes)
     {
         if (p.ContainsVertex(pos))
         {
             return(p.Prev(pos));
         }
     }
     return(null);
 }
示例#31
0
 // Update is called once per frame
 void Update()
 {
     if (selecting)
     {
         Inside.Rotate(0f, 0f, rotateFastInside * Time.deltaTime);
         Middle.Rotate(0f, 0f, rotateFastMiddle * Time.deltaTime);
         Outside.Rotate(0f, 0f, rotateFastOutside * Time.deltaTime);
     }
     else
     {
         Inside.Rotate(0f, 0f, rotateSpeedInside * Time.deltaTime);
         Middle.Rotate(0f, 0f, rotateSpeedMiddle * Time.deltaTime);
         Outside.Rotate(0f, 0f, rotateSpeedOutside * Time.deltaTime);
     }
 }
示例#32
0
    void Awake()
    {
        Textures.Create();
        normal.mainTexture = Textures.TILEMAP;

        tiles = new Tile[width, height];
        geometry = new Geometry(2);

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                tiles[x, y] = new Outside();
            }
        }

        GetComponent<MeshRenderer>().sharedMaterials = new Material[] { normal, outside };

        Create();
    }
示例#33
0
    public void modifyHoursActivity(Activity prevActivity, int newStart, int newEnd)
    {
        //we have to create a new activity and not only update the previous one not to have problems with sortActivity
        Activity newActivity;

        if (prevActivity is Inside)
        {
            newActivity = new Inside(newStart, newEnd, prevActivity.Place, prevActivity.Type);
        }
        else
        {
            newActivity = new Outside(newStart, newEnd, prevActivity.Place, prevActivity.Type);
        }
        newActivity.Description = prevActivity.Description;
        newActivity.L_astronaut = prevActivity.L_astronaut;

        rmActivity(prevActivity);
        addActivity(newActivity);
    }
示例#34
0
        // constructor
        public StripFSM()
        {
            itsStartingSlashState = new StartingSlash();
            itsOutsideState = new Outside();
            itsStarAfterSlashState = new StarAfterSlash();
            itsSecondSlashState = new SecondSlash();
            itsStartingStarState = new StartingStar();

            itsState = itsOutsideState;

            // Entry functions for: outside
            OutsideIn();
        }
示例#35
0
 private void setOutsideStory()
 {
     outStory = new Outside (names, dialogs, playerName);
     names = outStory.getNames ();
     dialogs = outStory.getDialogs ();
     backdrop.sprite = (Sprite)Resources.Load("Tutorial/street", typeof(Sprite));
     newStory = "Bakeshop1";
 }