void Start() { //Debug.Log(gameObject.name+" Start"); if (team == Team.Right) { myTeamLayerMask = LayerMask.GetMask("RightSide", "Barriers"); otherTeamLayerMask = LayerMask.GetMask("LeftSide", "Neutral", "Barriers"); this.gameObject.layer = LayerMask.NameToLayer("RightSide"); } else if (team == Team.Left) { myTeamLayerMask = LayerMask.GetMask("LeftSide", "Barriers"); otherTeamLayerMask = LayerMask.GetMask("RightSide", "Neutral", "Barriers"); this.gameObject.layer = LayerMask.NameToLayer("LeftSide"); } else //Neutral enenimes { myTeamLayerMask = LayerMask.GetMask("Neutral", "Barriers"); otherTeamLayerMask = LayerMask.GetMask("RightSide", "LeftSide", "Barriers"); this.gameObject.layer = LayerMask.NameToLayer("Neutral"); } powerHandler = this.GetComponent <PowerHandler>(); controlTurret = isServer || isLocalPlayer; //Other team should be red. setLocalColour(); }
public void OnUpdate() { if (checkAndUpdateCooldown()) { PowerHandler.getInstance().StartSurge(this.coords, 100); PollutionHandler.getInstance().pollute(polutionGenerated); } }
public void SetUp() { _game = MockRepository.GenerateMock <IGame>(); _gameHandler = MockRepository.GenerateMock <IGameHandler>(); _gameState = MockRepository.GenerateMock <IHsGameState>(); _gameState.Stub(x => x.GameHandler).Return(_gameHandler); _powerHandler = new PowerHandler(); }
// Start is called before the first frame update void Start() { gameManager = FindObjectOfType <GameManager>(); playerDir = FindObjectOfType <PlayerDirectionHandler>(); playerPower = FindObjectOfType <PowerHandler>(); angleChosen = 0; powerChosen = 0; healthBar.maxValue = healthBar.value = hp; }
void Start() { powerHandler = PowerHandler.getInstance(); trans = GetComponent <Transform> (); eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>(); conduitMoneyText.text = "$" + (new Conduit()).price; minerMoneyText.text = "$" + (new Miner()).price; heatLaserMoneyText.text = "$" + (new HeatLaser()).price; surgerMoneyText.text = "$" + (new Surger()).price; }
void playerIsSet() { //grab health //grab powers //set path to playerInput health = myPlayer.myPlayer.GetComponent <Health>(); if (health) { health.healthChange += updateBar; } powers = myPlayer.myPlayer.GetComponent <PowerHandler>(); /*for(int x=0;x<powers.powers.Length;x++) * { * powerButtons[0].setBound( powers.powers[1] ); * }*/ powerButtons[0].setBound(powers.powers[1]); playerInput = myPlayer.myPlayer.GetComponent <PlayerInputHandler>(); }
private static void ApplyThemeOptions(AdmConfig config, Theme newTheme, bool automatic, DateTime sunset, DateTime sunrise) { GlobalState state = GlobalState.Instance(); if (!ThemeOptionsNeedUpdate(config, newTheme)) { return; } PowerHandler.DisableEnergySaver(config); var oldsys = state.CurrentSystemTheme; var oldapp = state.CurrentAppsTheme; var oldedg = state.CurrentEdgeTheme; var oldwal = state.CurrentWallpaperTheme; var oldoff = state.CurrentOfficeTheme; var oldcol = state.ColorFilterEnabled; SetColorFilter(config.ColorFilterEnabled, newTheme); SetAppsTheme(config.AppsTheme, newTheme, state); SetEdgeTheme(config.EdgeTheme, newTheme, state); SetWallpaper(newTheme, state, config.Wallpaper.DarkThemeWallpapers, config.Wallpaper.LightThemeWallpapers, config.Wallpaper.Enabled); SetOfficeTheme(config.Office.Mode, newTheme, state, config.Office.LightTheme, config.Office.DarkTheme, config.Office.Enabled); //run async to delay at specific parts due to color prevalence not switching icons correctly int taskdelay = config.Tunable.AccentColorSwitchDelay; Task.Run(async() => { await SetSystemTheme(config.SystemTheme, newTheme, taskdelay, state, config); if (automatic) { Logger.Info($"theme switch invoked automatically. Sunrise: {sunrise.ToString("HH:mm:ss")}, Sunset: {sunset.ToString("HH:mm:ss")}"); } else { Logger.Info($"theme switch invoked manually"); } PowerHandler.RestoreEnergySaver(config); Logger.Info($"theme: {newTheme} with modes (s:{config.SystemTheme}, a:{config.AppsTheme}, e:{config.EdgeTheme}, w:{config.Wallpaper.Enabled}, o:{config.Office.Enabled}, c:{config.ColorFilterEnabled})"); Logger.Info($"was (s:{oldsys}, a:{oldapp}, e:{oldedg}, w:{oldwal}, o:{oldoff}, c:{oldcol})"); Logger.Info($"is (s:{state.CurrentSystemTheme}, a:{state.CurrentAppsTheme}, e:{state.CurrentEdgeTheme}, w:{state.CurrentWallpaperTheme}, o:{state.CurrentOfficeTheme}, c:{state.ColorFilterEnabled})"); }); }
public static void SwitchTheme(AdmConfig config, Theme newTheme, bool automatic = false, DateTime sunset = new DateTime(), DateTime sunrise = new DateTime()) { if (!automatic && state.ForcedTheme == Theme.Unknown) { Logger.Info($"theme switch invoked manually"); } bool themeModeSwitched = false; if (config.WindowsThemeMode.Enabled) { themeModeSwitched = ApplyTheme(config, newTheme); } // this is possibly necessary in the future if the config is internally updated and switchtheme is called before it is saved //cm.UpdateSettings(); List <ISwitchComponent> componentsToUpdate = cm.GetComponentsToUpdate(newTheme); if (componentsToUpdate.Count > 0) { //if a theme switch did not occur, run mitigations if (!themeModeSwitched) { PowerHandler.DisableEnergySaver(config); } cm.Run(componentsToUpdate, newTheme); } // disable mitigation after all components and theme switch have been executed if (componentsToUpdate.Count > 0 || themeModeSwitched) { if (newTheme == Theme.Light && automatic) { Logger.Info($"automatic light theme switch performed, sunrise: {sunrise:HH:mm:ss}"); } else if (newTheme == Theme.Dark && automatic) { Logger.Info($"automatic dark theme switch performed, sunset: {sunset:HH:mm:ss}"); } PowerHandler.RestoreEnergySaver(config); } }
void Start() { setPropValues(); rb = GetComponent <Rigidbody>(); rb.constraints = RigidbodyConstraints.FreezeAll; navAgent = GetComponent <NavMeshAgent>(); navAgent.speed = moveSpeed; powerHandler = new PowerHandler(transform, 1); enemyState = ENEMYSTATE.Idle; spawnPoints = SpawnsTables.spawnPoints; platesHolder = transform.GetChild(0).Find("Plates Holder"); List <Transform> allPlayers = new List <Transform>(); allPlayers = PlayersManager.allPlayers; allPlayers.Remove(transform); allOtherPlayer = allPlayers.ToArray(); }
/// <summary> /// Applies the theme using the KAWAII Theme switcher logic for windows theme files /// </summary> /// <param name="config"></param> /// <param name="newTheme"></param> /// <param name="automatic"></param> /// <param name="sunset"></param> /// <param name="sunrise"></param> /// <returns>true if an update was performed; false otherwise</returns> private static bool ApplyTheme(AdmConfig config, Theme newTheme) { GlobalState state = GlobalState.Instance(); if (config.WindowsThemeMode.DarkThemePath == null || config.WindowsThemeMode.LightThemePath == null) { Logger.Error("dark or light theme path empty"); return(false); } if (!File.Exists(config.WindowsThemeMode.DarkThemePath)) { Logger.Error($"invalid dark theme path: {config.WindowsThemeMode.DarkThemePath}"); return(false); } if (!File.Exists(config.WindowsThemeMode.LightThemePath)) { Logger.Error($"invalid light theme path: {config.WindowsThemeMode.LightThemePath}"); return(false); } if (!config.WindowsThemeMode.DarkThemePath.EndsWith(".theme") || !config.WindowsThemeMode.DarkThemePath.EndsWith(".theme")) { Logger.Error("both theme paths must have a .theme extension"); return(false); } // TODO change tracking when having active theme monitor disabled if (newTheme == Theme.Dark && !state.CurrentWindowsThemeName.Equals(Path.GetFileNameWithoutExtension(config.WindowsThemeMode.DarkThemePath), StringComparison.Ordinal)) { PowerHandler.DisableEnergySaver(config); ThemeHandler.Apply(config.WindowsThemeMode.DarkThemePath); return(true); } else if (newTheme == Theme.Light && !state.CurrentWindowsThemeName.Equals(Path.GetFileNameWithoutExtension(config.WindowsThemeMode.LightThemePath), StringComparison.Ordinal)) { PowerHandler.DisableEnergySaver(config); ThemeHandler.Apply(config.WindowsThemeMode.LightThemePath); return(true); } return(false); }
public void Start(IController controller) { try { Log.Debug("Starting and registering MPExtended powerhandler"); handler = new PowerHandler(); PowerScheduler.Instance.Register(handler); } catch (Exception ex) { Log.Error("Failed to register MPExtended powerhandler: {0}\r\n{1}", ex.Message, ex.StackTrace); } }
// Use this for initialization void Start() { movementHandler = this.GetComponent <MovementHandler>(); combatHandler = this.GetComponent <CombatHandler>(); powerHandler = this.GetComponent <PowerHandler>(); }
////////////////////////////////////////////////////////////// /// <summary> /// 客户端主循环 /// </summary> public void RunLoop() { int control = 1; int x = 0; int y = 0; string N = ""; while (control == 1) { Welcome(); InputTypeData(); //判断计算类型 if (type == '+') { Clear(); WriteLine("你选择了加法运算,输入任意非数字回到主菜单"); TwoElementEvent += new TwoElementHandler(myServer.Add); try { WriteLine("请输入第一个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第一个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第一个矩阵的列数:"); y = ToInt32(ReadLine()); A = new Matrix((string)N.Clone(), x, y); A.SetMatrix(); WriteLine("请输入第二个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第二个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第二个矩阵的列数:"); y = ToInt32(ReadLine()); B = new Matrix((string)N.Clone(), x, y); B.SetMatrix(); GetTwoElementEventResult(A, B); TwoElementEvent -= new TwoElementHandler(myServer.Add); Clear(); continue; } catch { //检测到非数字回到主菜单 Clear(); continue; } } else { if (type == '-') { Clear(); WriteLine("你选择了减法运算,输入任意非数字回到主菜单"); TwoElementEvent += new TwoElementHandler(myServer.Subduction); try { WriteLine("请输入第一个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第一个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第一个矩阵的列数:"); y = ToInt32(ReadLine()); A = new Matrix((string)N.Clone(), x, y); A.SetMatrix(); WriteLine("请输入第二个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第二个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第二个矩阵的列数:"); y = ToInt32(ReadLine()); B = new Matrix((string)N.Clone(), x, y); B.SetMatrix(); GetTwoElementEventResult(A, B); TwoElementEvent -= new TwoElementHandler(myServer.Subduction); Clear(); continue; } catch { Clear(); continue; } } else { if (type == '$') { Clear(); WriteLine("你选择了乘方运算,输入任意非数字回到主菜单"); PowerEvent += new PowerHandler(myServer.Power); try { int mz = 0; WriteLine("请输入矩阵的名字:"); N = ReadLine(); WriteLine("请输入矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入矩阵的列数:"); y = ToInt32(ReadLine()); A = new Matrix((string)N.Clone(), x, y); A.SetMatrix(); WriteLine("请输入幂指数"); mz = ToInt32(ReadLine()); GetPowerEventResult(A, mz); PowerEvent -= new PowerHandler(myServer.Power); Clear(); continue; } catch { Clear(); continue; } } else { if (type == 'D' || type == 'd') { Clear(); WriteLine("你选择了求行列式运算,输入任意非数字回到主菜单"); DetaminateEvent += new DetaminateHandler(myServer.Detaminate); try { WriteLine("请输入矩阵的名字:"); N = ReadLine(); WriteLine("请输入矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入矩阵的列数:"); y = ToInt32(ReadLine()); A = new Matrix((string)N.Clone(), x, y); A.SetMatrix(); GetDetaminateEvent(A); DetaminateEvent -= new DetaminateHandler(myServer.Detaminate); Clear(); continue; } catch { Clear(); continue; } } else { if (type == '*') { Clear(); WriteLine("你选择了乘法运算,输入任意非数字回到主菜单"); TwoElementEvent += new TwoElementHandler(myServer.Multi); try { WriteLine("请输入第一个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第一个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第一个矩阵的列数:"); y = ToInt32(ReadLine()); A = new Matrix((string)N.Clone(), x, y); A.SetMatrix(); WriteLine("请输入第二个矩阵的名字:"); N = ReadLine(); WriteLine("请输入第二个矩阵的行数:"); x = ToInt32(ReadLine()); WriteLine("请输入第二个矩阵的列数:"); y = ToInt32(ReadLine()); B = new Matrix((string)N.Clone(), x, y); B.SetMatrix(); GetTwoElementEventResult(A, B); TwoElementEvent -= new TwoElementHandler(myServer.Multi); Clear(); continue; } catch { Clear(); continue; } } } } } } } }
private void Awake() { rb = GetComponent <Rigidbody>(); joyStick = GetComponent <Joystick>(); powerHandler = new PowerHandler(transform, 1); }