Пример #1
0
 public void EnterHouse()
 {
     houseState            = HouseState.Inside;
     spriteRenderer.sprite = innerHouse;
     leftCollider.enabled  = true;
     rightCollider.enabled = true;
 }
Пример #2
0
 public void LeaveHouse()
 {
     houseState            = HouseState.Outside;
     spriteRenderer.sprite = outerHouse;
     leftCollider.enabled  = false;
     rightCollider.enabled = false;
 }
Пример #3
0
    public void SwitchState(HouseState _HouseState)
    {
        switch (_HouseState)
        {
        case HouseState.Locked:
            overlay.SetActive(true);
            overlaySpriteRenderer.sprite = LockedSprite;
            spriteRenderer.color         = new Color(255, 255, 255, 255);
            break;

        case HouseState.Unlocked:
            overlay.SetActive(false);
            spriteRenderer.color = new Color(255, 255, 255, 0);
            break;

        case HouseState.Selected:
            overlay.SetActive(true);
            overlaySpriteRenderer.sprite = HighLightSprite;
            break;

        default:
            break;
        }
        houseState = _HouseState;
    }
Пример #4
0
    private void UpdateHouseState(HouseState newState)
    {
        var color = GetColor(newState);

        _spriteRenderer.color = color;
        _state = newState;
    }
Пример #5
0
        private HouseState GetHouseStatesByName(string houseState)
        {
            HouseState getHouseState = TipezeNyumbaUnitOfWork.Repository <HouseState>()
                                       .Get(u => u.HouseStatus.ToLower() == houseState.ToLower());

            return(getHouseState);
        }
Пример #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            HouseState houseState = db.HouseStates.Find(id);

            db.HouseStates.Remove(houseState);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #7
0
    private void ResetHouse()
    {
        var newState = HouseState.Neutral;

        _state = newState;
        _spriteRenderer.color = GetColor(newState);

        health = Random.Range(100f, 250f);
    }
Пример #8
0
        public bool UpdateHouseDetails(int id, HouseModel houseDetails)
        {
            District checkDistrictHouseIsLocated = GetDistrictByName(houseDetails.districtHouseIsLocated);

            if (checkDistrictHouseIsLocated == null)
            {
                return(false);
            }
            LocationsInDistrict checkLocationInDistrict = GetLocationInDistrictByName(checkDistrictHouseIsLocated.districtID, houseDetails.districtHouseIsLocated);

            if (checkLocationInDistrict == null)
            {
                return(false);
            }
            HouseState checkHouseState = GetHouseStatesByName(houseDetails.houseState);

            if (checkHouseState == null)
            {
                return(false);
            }
            FenceType checkFenceType = GetFenceTypeByName(houseDetails.fenceType);

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

            House houseToUpdate = TipezeNyumbaUnitOfWork.Repository <House>().Get(u => u.houseID == id);

            if (houseToUpdate == null)
            {
                return(false);
            }
            houseToUpdate.districtHouseIsLocated = checkDistrictHouseIsLocated.districtID;
            houseToUpdate.locationWithInDistrict = checkLocationInDistrict.districtLocationID;
            houseToUpdate.bedrooms                 = houseDetails.bedrooms;
            houseToUpdate.masterBedroomEnsuite     = houseDetails.masterBedroomEnsuite;
            houseToUpdate.selfContained            = houseDetails.selfContained;
            houseToUpdate.numberOfGarages          = houseDetails.numberOfGarages;
            houseToUpdate.fenceType                = checkFenceType.fenceTypeID;
            houseToUpdate.dateHouseWillBeAvailable = Convert.ToDateTime(houseDetails.dateHouseWillBeAvailable);
            houseToUpdate.price             = houseDetails.price;
            houseToUpdate.modeOfPayment     = Convert.ToInt32(houseDetails.modeOfPayment);
            houseToUpdate.dateUploaded      = Convert.ToDateTime(houseDetails.dateUploaded);
            houseToUpdate.description       = houseDetails.description;
            houseToUpdate.currentHouseState = checkHouseState.houseStateID;

            houseToUpdate.HouseContactDetail.phoneNumber1          = houseDetails.phoneNumber1;
            houseToUpdate.HouseContactDetail.phoneNumber2          = houseDetails.phoneNumber2;
            houseToUpdate.HouseContactDetail.whatsAppContactNumber = houseDetails.whatsAppContactNumber;
            houseToUpdate.HouseContactDetail.email = houseDetails.email;

            TipezeNyumbaUnitOfWork.Repository <House>().Attach(houseToUpdate);
            TipezeNyumbaUnitOfWork.SaveChanges();
            return(true);
        }
Пример #9
0
 public ActionResult Edit([Bind(Include = "HouseStateId,HouseName,HouseType,Postcode,RentRate,MainAddress,Suburb,Region,Description,Bedroom,Bathroom,CarparkOk,PetOk,OnMarktetFlg,Latitude,Longitude")] HouseState houseState)
 {
     if (ModelState.IsValid)
     {
         db.Entry(houseState).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(houseState));
 }
Пример #10
0
    public void StartGame()
    {
        GameControllerConfig gameControllerConfig = GameObject.FindGameObjectWithTag("GameControllerConfig").GetComponent <GameControllerConfig>();

        Score           = 0;
        IndicatorsFound = 0;

        int amountHouses = 0;

        if (difficulty == Difficulty.EASY)
        {
            amountHouses = 15;
            TimeLeft     = 300; // 5 minutes
        }
        else if (difficulty == Difficulty.MEDIUM)
        {
            amountHouses = 20;
            TimeLeft     = 240; // 4 minutes
        }
        else if (difficulty == Difficulty.HARD)
        {
            amountHouses = 25;
            TimeLeft     = 180; // 3 minutes
        }

        houses = new List <HouseState>();
        for (int i = 0; i < amountHouses; i++)
        {
            HouseState house = new HouseState();
            house.prefab = gameControllerConfig.housePrefabs[Mathf.FloorToInt(Random.Range(0, gameControllerConfig.housePrefabs.Count - 0.01f))];
            houses.Add(house);
        }

        int indicatorsGenerated = 0;

        while (indicatorsGenerated < IndicatorsTotal)
        {
            int index = Mathf.FloorToInt(Random.Range(0, amountHouses - 0.01f));
            if (houses[index].indicator == null)
            {
                IndicatorController controller = houses[index].prefab.GetComponent <IndicatorController>();
                int indicatorIndex             = Mathf.FloorToInt(Random.Range(0, controller.indicators.Count - 0.01f));
                houses[index].indicator = controller.indicators[indicatorIndex].name;
                indicatorsGenerated++;
            }
        }

        enteredHouse = -1;

        gameState = GameState.PLAYING;

        StartCoroutine(DecrementTimer());
    }
Пример #11
0
        // GET: HouseStates/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HouseState houseState = db.HouseStates.Find(id);

            if (houseState == null)
            {
                return(HttpNotFound());
            }
            return(View(houseState));
        }
Пример #12
0
        public House(HouseType houseType,
			string builder,
			int x,
			int y,
			int width,
			int height,
			HouseState houseState = HouseState.Building)
        {
            this.houseType = houseType;
            this.houseState = houseState;
            this.builder = builder;
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
        }
Пример #13
0
        public override void Resume()
        {
            Managers.Display.ShowFlash(1);
            gSkinB.label.fontSize       = 16;
            Managers.Audio.Music.volume = .65f;


            if (Managers.Game.PlayerPrefab)
            {
                Managers.Game.IsPlaying = true;

                if (Managers.Register.YaguaDefeated && Managers.Register.MonaiDefeated && !Managers.Register.YasiYatereDefeated)
                {
                    if (Managers.Register.UnlockedStages <= 3)
                    {
                        Managers.Register.UnlockedStages = 4;
                    }
                    Managers.Tiled.Load("/Levels/Home2.tmx");
                }
                else if (Managers.Register.YasiYatereDefeated)
                {
                    if (Managers.Register.UnlockedStages <= 4)
                    {
                        Managers.Register.UnlockedStages = 5;
                    }
                    Managers.Tiled.Load("/Levels/Home3.tmx");
                }
                else
                {
                    Managers.Tiled.Load("/Levels/Home1.tmx");
                }

                //Managers.Display.camTransform.position = Vector3.zero;
                Managers.Display.camTransform.position = new Vector3(3.75f, 2.5f, 0);


                //Managers.Game.IsPlaying = false;
                Managers.Game.PlayerPrefab.GetComponent <PlayerControls>().enabled = false;
                Managers.Game.IsPaused = true;
            }

            currentState = HouseState.Menu;

            //Managers.Game.IsPaused = true;
            //Time.timeScale = 0.00000000000001f;
        }
Пример #14
0
    /// <summary>
    ///     Converts House State to real state in Home Assistant
    /// </summary>
    /// <param name="state">State to set</param>
    private void SetHouseState(HouseState state)
    {
        var select_state = state switch
        {
            HouseState.Morning => "Morgon",
            HouseState.Day => "Dag",
            HouseState.Evening => "Kväll",
            HouseState.Night => "Natt",
            HouseState.Cleaning => "Städning",
            _ => throw new ArgumentException("Not supported", nameof(state))
        };

        Log($"Setting housestate: {select_state} to {HouseStateInputSelect}");
        // Get the state now
        var currentState = State(HouseStateInputSelect !);

        if (currentState?.State != select_state)
        {
            CallService("input_select", "select_option", new { entity_id = HouseStateInputSelect !, option = select_state });
Пример #15
0
    private Color32 GetColor(HouseState state)
    {
        if (state == HouseState.Angry)
        {
            return(new Color32(201, 29, 18, 255));
        }

        if (state == HouseState.Dead)
        {
            return(new Color32(47, 47, 47, 255));
        }

        if (state == HouseState.Hungry)
        {
            return(new Color32(0, 153, 0, 255));
        }

        // Neutral
        return(new Color32(255, 255, 255, 255));
    }
Пример #16
0
        public override void DeInit()
        {
            //Managers.Game.IsPaused = false;
            //Time.timeScale = 1;
            if (Managers.Game.PlayerPrefab)
            {
                Managers.Game.PlayerPrefab.GetComponent <PlayerControls>().enabled = true;
                Managers.Game.IsPaused = false;
            }
            //if (Managers.Game.PlayerPrefab)
            //    Managers.Game.PlayerPrefab.SetActive(true);

            TotalOptions = 0;
            OptionsList.Clear();
//        Increment = 0;
            gSkinB.label.fontSize = Mathf.RoundToInt(Screen.width * 0.035f);
            currentState          = HouseState.Start;

            Managers.Audio.Music.volume = prevVolume;
        }
Пример #17
0
        public bool UpdateHouseStatus(int houseId, string houseStatus)
        {
            HouseState checkHouseState = GetHouseStatesByName(houseStatus);

            if (checkHouseState == null)
            {
                return(false);
            }
            try
            {
                House getHouseToUpdate = TipezeNyumbaUnitOfWork.Repository <House>().Get(u => u.houseID == houseId);
                getHouseToUpdate.currentHouseState = checkHouseState.houseStateID;
                TipezeNyumbaUnitOfWork.Repository <House>().Attach(getHouseToUpdate);
                TipezeNyumbaUnitOfWork.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Пример #18
0
    /// <summary>
    ///     Converts House State to real state in Home Assistant
    /// </summary>
    /// <param name="state">State to set</param>
    private async Task SetHouseState(HouseState state)
    {
        var select_state = state switch
        {
            HouseState.Morning => "Morgon",
            HouseState.Day => "Dag",
            HouseState.Evening => "Kväll",
            HouseState.Night => "Natt",
            HouseState.Cleaning => "Städning",
            _ => throw new ArgumentException("Not supported", nameof(state))
        };

        Log($"Setting housestate: {select_state} to {HouseStateInputSelect}");
        // Get the state now
        var currentState = GetState(HouseStateInputSelect !);

        if (currentState?.State != select_state)
        {
            await InputSelect(HouseStateInputSelect !)
            .SetOption(select_state)
            .ExecuteAsync();
        }
    }
}
Пример #19
0
        public bool AddHouse(HouseModel newHouseModel)
        {
            District checkDistrictHouseIsLocated = GetDistrictByName(newHouseModel.districtHouseIsLocated);

            if (checkDistrictHouseIsLocated == null)
            {
                return(false);
            }
            LocationsInDistrict checkLocationInDistrict = GetLocationInDistrictByName(checkDistrictHouseIsLocated.districtID, newHouseModel.locationInDistrict);

            if (checkLocationInDistrict == null)
            {
                return(false);
            }
            HouseState checkHouseState = GetHouseStatesByName(newHouseModel.houseState);

            if (checkHouseState == null)
            {
                return(false);
            }
            FenceType checkFenceType = GetFenceTypeByName(newHouseModel.fenceType);

            if (checkFenceType == null)
            {
                return(false);
            }
            int activatedState = _fieldStateManagement.GetActivatedState().fieldStateID;

            House newHouse = new House()
            {
                districtHouseIsLocated = checkDistrictHouseIsLocated.districtID,
                locationWithInDistrict = checkLocationInDistrict.districtLocationID,
                bedrooms                 = newHouseModel.bedrooms,
                masterBedroomEnsuite     = newHouseModel.masterBedroomEnsuite,
                selfContained            = newHouseModel.selfContained,
                numberOfGarages          = newHouseModel.numberOfGarages,
                fenceType                = checkFenceType.fenceTypeID,
                dateHouseWillBeAvailable = Convert.ToDateTime(newHouseModel.dateHouseWillBeAvailable),
                price             = newHouseModel.price,
                modeOfPayment     = Convert.ToInt32(newHouseModel.modeOfPayment),
                dateUploaded      = DateTime.Now,
                description       = newHouseModel.description,
                currentHouseState = checkHouseState.houseStateID,
                state             = activatedState
            };

            HouseContactDetail houseContactDetail = new HouseContactDetail()
            {
                houseID               = newHouse.houseID,
                phoneNumber1          = newHouseModel.phoneNumber1,
                phoneNumber2          = newHouseModel.phoneNumber2,
                whatsAppContactNumber = newHouseModel.whatsAppContactNumber,
                email = newHouseModel.email,
                state = activatedState
            };


            HouseOwner setHouseOwner = new HouseOwner()
            {
                userID  = newHouseModel.userId,
                houseID = newHouseModel.houseID,
                status  = activatedState
            };

            TipezeNyumbaUnitOfWork.Repository <House>().Add(newHouse);
            TipezeNyumbaUnitOfWork.Repository <HouseContactDetail>().Add(houseContactDetail);
            TipezeNyumbaUnitOfWork.Repository <HouseOwner>().Add(setHouseOwner);
            TipezeNyumbaUnitOfWork.SaveChanges();
            return(true);
        }
Пример #20
0
        public override void OnUpdate()
        {
            if (Input.GetKeyDown("escape") || Input.GetButtonDown("Start") || Input.GetButtonDown("Select"))
            {
                if (currentState == HouseState.Menu)
                {
                    Managers.Audio.Play(Doors, Managers.Display.camTransform);
                    Managers.Game.PopState();
                }
                else
                {
                    Managers.Audio.Play(Clang, Managers.Display.camTransform);
                    currentState = HouseState.Menu;
                }
            }


            switch (currentState)
            {
            case HouseState.Start:
                currentState = HouseState.Menu;
                break;

            case HouseState.Menu:

                if (Managers.Game.InputDown && (ChooseOption > 0))
                {
                    Managers.Audio.Play(Select, Managers.Display.camTransform);
                    ChooseOption--;
                }
                if (Managers.Game.InputUp && (ChooseOption < (TotalOptions - 1)))
                {
                    Managers.Audio.Play(Select, Managers.Display.camTransform);
                    ChooseOption++;
                }

                switch (OptionsList[(int)ChooseOption])
                {
                case "Salir":                     // Salir
                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        Managers.Audio.Play(Doors, Managers.Display.camTransform);

                        Managers.Display.ShowFlash(.5f);
                        Managers.Game.PopState();
                    }
                    break;

                case "Tomar Mate":                     // Mate
                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        Managers.Display.ShowFlash(.25f);
                        //Managers.Display.ShowStatus();
                        Managers.Audio.Play(HealthRefill, Managers.Display.camTransform);
                        Managers.Register.Health = 3;
                    }
                    break;

                case "Ver Concept Arts":                     // Arte Concept
                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        Managers.Audio.Play(Play, Managers.Display.camTransform);
                        Managers.Display.ShowFlash(.2f);
                        currentState            = HouseState.Concept;
                        Managers.Game.IsPlaying = false;
                    }
                    break;

                case "Escuchar Musica:":                     // Musica

                    if (Managers.Game.InputLeft && ChooseMusic > 0)
                    {
                        Managers.Audio.Play(Select, Managers.Display.camTransform);
                        ChooseMusic--;
                    }
                    if (Managers.Game.InputRight && ChooseMusic < TotalMusics - 1)
                    {
                        Managers.Audio.Play(Select, Managers.Display.camTransform);
                        ChooseMusic++;
                    }

                    //ChooseMusic = (uint)Mathf.Clamp(ChooseMusic, 0, TotalMusics-1);

                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        if ((Managers.Audio.Music.clip == MusicList[ChooseMusic]) && Managers.Audio.Music.isPlaying)
                        {
                            Managers.Audio.Play(Clang, Managers.Display.camTransform);
                            Managers.Audio.StopMusic();
                        }
                        else
                        {
                            Managers.Audio.PlayMusic(MusicList[ChooseMusic], 0.65f, 1);
                            Managers.Audio.Play(Play, Managers.Display.camTransform);
                        }
                    }
                    break;

                case "Portal Dimensional:":                     // Inter-Dimensional Devicet

                    if (Managers.Game.InputLeft && ChooseWorld > 0)
                    {
                        Managers.Audio.Play(Select, Managers.Display.camTransform);
                        ChooseWorld--;
                    }
                    if (Managers.Game.InputRight && ChooseWorld < TotalWorlds - 1)
                    {
                        Managers.Audio.Play(Select, Managers.Display.camTransform);
                        ChooseWorld++;
                    }

                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        Managers.Audio.Play(Play, Managers.Display.camTransform);
                        Managers.Display.ShowFlash(1.5f);

                        if (WorldsList[ChooseWorld] == "Sarasa")
                        {
                            Managers.Display.ShowFlash(1.5f);
                            LoadWorld("/Levels/ElseWorld1.tmx");
                        }
                        else if (WorldsList[ChooseWorld] == "Jarana")
                        {
                            Managers.Display.ShowFlash(1.5f);
                            LoadWorld("/Levels/ElseWorld2.tmx");
                        }
                        else
                        {
                            Managers.Display.ShowFlash(1.5f);
                            LoadWorld("/Levels/ElseWorld3.tmx");
                        }
                    }
                    break;

                case "Leer Historietas":                     // Comic
                    if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return"))
                    {
                        Managers.Audio.Play(Play, Managers.Display.camTransform);
                        Managers.Display.ShowFlash(.2f);
                        currentState            = HouseState.Comics;
                        Managers.Game.IsPlaying = false;
                    }
                    break;
                }

                break;

            case HouseState.Concept:

                if (Managers.Game.InputLeft && ChoosePic > 0)
                {
                    Managers.Audio.Play(Clang, Managers.Display.camTransform);
                    ChoosePic--;
                }
                if (Managers.Game.InputRight && ChoosePic < TotalPics - 1)
                {
                    Managers.Audio.Play(Clang, Managers.Display.camTransform);
                    ChoosePic++;
                }

                if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return") || Input.GetKeyDown("escape") ||
                    Input.GetKeyDown("escape") || Input.GetButtonDown("Fire3") || Input.GetButtonDown("Select"))
                {
                    Managers.Audio.Play(Play, Managers.Display.camTransform);
                    Managers.Display.ShowFlash(.5f);
                    currentState            = HouseState.Menu;
                    Managers.Game.IsPlaying = true;
                }
                break;

            case HouseState.ElseWorlds:
                break;

            case HouseState.Comics:
                if (Managers.Game.InputLeft && ChooseComic > 0)
                {
                    Managers.Audio.Play(Clang, Managers.Display.camTransform);
                    ChooseComic--;
                }

                if (Managers.Game.InputRight && ChooseComic < TotalComics - 1)
                {
                    Managers.Audio.Play(Clang, Managers.Display.camTransform);
                    ChooseComic++;
                }

                if (Input.GetButtonDown("Fire1") || Input.GetKeyDown("return") || Input.GetKeyDown("escape") ||
                    Input.GetKeyDown("escape") || Input.GetButtonDown("Fire3") || Input.GetButtonDown("Select"))
                {
                    Managers.Audio.Play(Play, Managers.Display.camTransform);
                    Managers.Display.ShowFlash(.5f);
                    currentState            = HouseState.Menu;
                    Managers.Game.IsPlaying = true;
                }
                break;
            }
        }