Ejemplo n.º 1
0
        public async Task <Result <HomeBaseResponse> > AddHomeBaseAsync(AddHomeBaseCommand request)
        {
            HomeBase baseToAdd = new HomeBase();

            try
            {
                baseToAdd = _mapper.Map <HomeBase>(request);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new Result <HomeBaseResponse>(e));
            }

            _dbContext.Add(baseToAdd);

            try
            {
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new Result <HomeBaseResponse>(new InternalErrorException(Error.ErrorWhileProcessingOperation)));
            }

            return(new Result <HomeBaseResponse>(_mapper.Map <HomeBaseResponse>(baseToAdd)));
        }
Ejemplo n.º 2
0
        public HomeBaseScene(Game game) : base(game)
        {
            roomLabelsEnabled = false;

            homeBase             = new HomeBase(25, 25);
            homeBase.Rooms[1, 2] = new Room(homeBase, 1, 2, RoomType.LivingQuarters);
            homeBase.Rooms[2, 2] = new Room(homeBase, 2, 2, RoomType.Kitchen);
            homeBase.Rooms[3, 2] = new Room(homeBase, 3, 2, RoomType.Gym);
            homeBase.Rooms[2, 1] = new Room(homeBase, 2, 1, RoomType.FiringRange);
            homeBase.Rooms[2, 3] = new Room(homeBase, 2, 3, RoomType.Generator);

            homeBase.Rooms[1, 2].AddExit(Direction.East, homeBase.Rooms[2, 2]);
            homeBase.Rooms[3, 2].AddExit(Direction.West, homeBase.Rooms[2, 2]);
            homeBase.Rooms[2, 1].AddExit(Direction.South, homeBase.Rooms[2, 2]);
            homeBase.Rooms[2, 3].AddExit(Direction.North, homeBase.Rooms[2, 2]);


            baseImage = RexPaintImageLoader
                        .LoadImage("Assets/HomeBase/base.xp");
            labels = RexPaintImageLoader
                     .LoadImage("Assets/HomeBase/labels.xp");
            cameraX        = cameraY = 0;
            roomSelectionX = 1;
            roomSelectionY = 1;
            MoveRoomSelection(0, 0);
        }
Ejemplo n.º 3
0
    public void load()
    {
        XmlSerializer serialzer = new XmlSerializer(typeof(HomeBase));
        TextReader    reader    = new StringReader(PlayerPrefs.GetString("SaveGame0"));

        homeBase = (HomeBase)serialzer.Deserialize(reader);
        reader.Close();
    }
Ejemplo n.º 4
0
        public async Task DeleteHomeBaseAsync(HomeBase homeBase)
        {
            var homeBaseInDb = _dbContext.HomeBases.Find(homeBase.Id);

            _dbContext.HomeBases.Remove(homeBaseInDb);

            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 5
0
        public async Task UpdateHomeBaseAsync(HomeBase homeBase)
        {
            var homeBaseInDb = _dbContext.HomeBases.Find(homeBase.Id);

            homeBaseInDb = _mapper.Map(homeBase, homeBaseInDb);

            _dbContext.HomeBases.Update(homeBaseInDb);

            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 6
0
    void Start()
    {
        spawnTime = Time.time;
        this.center = FindObjectOfType<HomeBase>();
        Debug.Log(name + " => " + this.center.name);
        Rigidbody rb = GetComponent<Rigidbody>();
        rb.velocity = transform.forward * speed;

        StartEngine();
    }
Ejemplo n.º 7
0
 private void OnPlayBackStarted(global::MediaPortal.Player.g_Player.MediaType type, string filename)
 {
     Log.Debug("TvHome: OnPlayBackStarted");
     if (PluginMain.Navigator.IsLiveStreamOn)
     {
         if (type == g_Player.MediaType.TV || type == g_Player.MediaType.Radio)
         {
             // set audio track based on user prefs.
             g_Player.CurrentAudioStream = HomeBase.GetPreferedAudioStreamIndex();
         }
         else
         {
             // Playback of another type has started while live TV was still on, so let's end the live TV stream.
             PluginMain.Navigator.StopLiveStream();
         }
     }
 }
Ejemplo n.º 8
0
        private void SaveSettings(bool onlyServerSettings)
        {
            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.Server, _serverSettings.ServerName);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.TcpPort, _serverSettings.Port);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.MacAddresses, _serverSettings.WakeOnLan.MacAddresses);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.IPAddress, _serverSettings.WakeOnLan.IPAddress);
                xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.UseWakeOnLan, _serverSettings.WakeOnLan.Enabled);
                xmlwriter.SetValue(_settingSection, TvHome.SettingName.WakeOnLanTimeoutSeconds, _serverSettings.WakeOnLan.TimeoutSeconds);

                if (!onlyServerSettings)
                {
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.NoClientStandbyWhenNotHome, _standbyOnHomeButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.AvoidRtspForLiveTv, !_rtspStreamingTVButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.PlayRecordingsOverRtsp, _rtspStreamingRecButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.AutoStreamingMode, _autoStreamingButton.Selected);
                    xmlwriter.SetValueAsBool(_settingSection, TvHome.SettingName.IsSingleSeat, Utility.IsThisASingleSeatSetup(_serverSettings.ServerName));

                    xmlwriter.SetValueAsBool("mytv", "enableRecNotifier", _recordingNotificationButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "autofullscreen", _autoFullScreenButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "showchannelnumber", _showChannelNumbersButton.Selected);
                    xmlwriter.SetValueAsBool("mytv", "hideAllChannelsGroup", _hideAllChannelsGroupButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "dvbbitmapsubtitles", _dvbSubtitlesButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "dvbttxtsubtitles", _teletextSubtitleButton.Selected);
                    xmlwriter.SetValueAsBool("tvservice", "preferac3", _preferAC3Button.Selected);
                }
            }

            PluginMain.ClearCachedBooleanSettings();
            if (PluginMain.Navigator != null)
            {
                PluginMain.Navigator.Reload();
            }

            TvHome.SettingChanged();
            HomeBase.OnSettingChanged();
        }
Ejemplo n.º 9
0
    public void SpawnUnit()
    {
        GameObject clickedOn = pInput.GetLastClicked();

        if (clickedOn)
        {
            Structure s = clickedOn.GetComponent <Structure>();
            if (s == null)
            {
                Debug.Log("hey spawn unit() there is no s : " + clickedOn.gameObject.name);
                return;
            }
            switch (s.myStructType)
            {
            case Structure.STRUCT_TYPE.HOMEBASE:
                HomeBase hb = clickedOn.GetComponent <HomeBase>();
                //myProduceUnit = hb.ProduceWorker;
                if (hb.GetIsBuilding() == false)
                {
                    hb.SetIsBuilding(true, hb.GetWorkerBuildTime());
                }
                break;

            case Structure.STRUCT_TYPE.RAX:
                break;

            case Structure.STRUCT_TYPE.FACTORY:
                break;

            case Structure.STRUCT_TYPE.STARPORT:
                break;

            default:
                break;
            }
            // myProduceUnit();
        }
    }
Ejemplo n.º 10
0
 //singleton design and create player, button manager if not in scene
 private void Awake()
 {
     GameObject.DontDestroyOnLoad(this);
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
         homeBase  = new HomeBase();
     }
     mapGen = GetComponent <MapGen>();
     if (!playerInst)
     {
         playerInst    = true;
         playerObjInst = Instantiate(player, new Vector3(0, 10, 0), Quaternion.identity);
     }
     if (!buttonManagerInst)
     {
         buttonManagerInst    = true;
         buttonManagerObjInst = Instantiate(buttonManager);
     }
 }
Ejemplo n.º 11
0
 private void Awake()
 {
     homebase  = GameObject.Find("Charging Station");
     energyObj = homebase.GetComponent <HomeBase>();
 }
Ejemplo n.º 12
0
 //Reloads scene in base
 public void newGame()
 {
     SceneManager.LoadScene("HomeBase");
     homeBase = new HomeBase();
 }
Ejemplo n.º 13
0
        public async Task AddHomeBaseAsync(HomeBase homeBase)
        {
            _dbContext.HomeBases.Add(homeBase);

            await _dbContext.SaveChangesAsync();
        }
Ejemplo n.º 14
0
 public void SetHomeBaseData(HomeBase data)
 {
     this.HomeBaseData = data;
 }
Ejemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     HB = FindObjectOfType <HomeBase>();
     resultsPanel.SetActive(false);
     StartCoroutine(Timer());
 }
Ejemplo n.º 16
0
 private void OnAudioTracksReady()
 {
     g_Player.CurrentAudioStream = HomeBase.GetPreferedAudioStreamIndex();
 }
Ejemplo n.º 17
0
 private void Awake()
 {
     mainCamera = FindObjectOfType <Camera>();
     homeBase   = FindObjectOfType <HomeBase>();
     AgentSpawner.OnLastWaveEndedSuccessfully += EndGame;
 }
    public HomeBase homebase;                     //    Reference to Enemy's target

    /*--------------------------------------------------------------------------------------*/
    /*																						*/
    /*	Start: Runs once at the begining of the game initalizes variables.					*/
    /*																						*/
    /*--------------------------------------------------------------------------------------*/
    void Start()
    {
        homebase = GameObject.Find("Home").GetComponent <HomeBase>();
    }