[HideInInspector] public Vector3 checkpoint; //point de retour en cas de gameover /////////////////////////////////////////////////// INIT /////////////////////////////////////////////////////// // Use this for initialization void Start() { _rb2d = GetComponent <Rigidbody2D>(); //init l'action onAction = false; powerController = null; //init la lumiere et la queue _tail = GetComponent <TrailRenderer>(); _light = GetComponent <Light>(); //Component[] l = GetComponentsInChildren(typeof(Light)); //_light = l[0] as Light; //init le score et l'etat de jeu score = 0; gameOver = false; GameObject[] stars; stars = GameObject.FindGameObjectsWithTag("Collectable"); _numOfStars = stars.Length; _maxScore = 0; _scale = transform.localScale.x; foreach (GameObject star in stars) { _maxScore += star.GetComponent <StarController>().score; } //_c2d = GetComponent<Collider2D>(); Debug.Log("player ready!"); }
// Use this for initialization void Start() { RightCollider.SetActive(false); LeftCollider.SetActive(false); CameraShake = GameObject.Find("Main Camera").GetComponent <CameraShake>(); pw = gameObject.GetComponent <PowerController>(); }
private void Start() { shipController = shipObject.GetComponent <ShipController>(); heatController = heatObject.GetComponent <HeatController>(); powerController = powerObject.GetComponent <PowerController>(); audioManager = FindObjectOfType <AudioManager>(); }
void Awake() { //Everyone have a tail gameObject.AddComponent <Tail>(); PowerController powerController = gameObject.AddComponent <PowerController>(); //Server side controls the collisions if (NetworkHelper.IsServerSide()) { TailController tail_controller = gameObject.AddComponent <TailController>(); tail_controller.GetOffenceDriverStack().Push(new DefaultOffenceDriver(offence)); tail_controller.GetDefenceDriverStack().Push(new DefaultDefenceDriver(defence)); tail_controller.GetAttacherDriverStack().Push(new DefaultAttacherDriver()); tail_controller.GetDetacherDriverStack().Push(new DefaultDetacherDriver()); } //Client side controls the movement if (NetworkHelper.IsOwnerSide(networkView)) { MovementController movement_controller = gameObject.AddComponent <MovementController>(); movement_controller.enabled = false; movement_controller.GetEngineDriverStack().Push(new DefaultEngineDriver(speed)); movement_controller.GetWheelDriverStack().Push(new DefaultWheelDriver(steering)); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { Controller controller = (Controller)filterContext.Controller; Employee emp = (Employee)controller.Session[SessionConst.Employee]; IList <EmpModFunc> emfs = (IList <EmpModFunc>)controller.Session[SessionConst.EmpModFuncs]; if (emp != null && emfs == null) { emfs = GetEmpModFuncs(emp); //把用户权限赋给SESSION controller.Session[SessionConst.EmpModFuncs] = emfs; } if (emp == null) { if (IsFilter) { throw new Exceptions.IsNoLoginException(); } } if (filterContext.Controller is PowerController) { PowerController bc = (PowerController)filterContext.Controller; if (emp != null) { bc.MySelf = emp; bc.MyModFunc = emfs; } } }
public float RechargeAmount = 50f; // hard coded for now, make variable // Use this for initialization void Start() { // TODO - get renderers automatically _targeter = GetComponent <TargetableComponentController>(); // get faction of ship var ship = transform.parent.parent.GetComponent <ShipController>(); Color = FactionColors.ShieldColor[ship.Faction]; _strength = MaxStrength; _strengthAtStartOfTurn = _strength; _collider = GetComponent <Collider>(); SetShaderParams(); SetBeamPositions(); PowerPlant = GetComponentInParent <ShipController>().GetComponentInChildren <PowerController>(); // for now assumes one power plant per ship GameManager.Instance.RegisterOnResetToStart(OnResetToStart); GameManager.Instance.RegisterOnStartOfPlanning(OnStartOfPlanning); GameManager.Instance.RegisterOnStartOfOutcome(OnStartOfOutcome); GameManager.Instance.RegisterOnEndOfTurn(OnEndOfTurn); }
public async Task ForMultiPortDevice_TurnOn_Port1_SendsTurnOnPort1() { // Arrange string messageId = "Message12"; var device = new DeviceDto { Id = "Endpoint1" }; var deviceAndPort = new DeviceAndPort(device, 1); var request = BuildRequest(messageId, "TurnOn", deviceAndPort.ToString()); List <DeviceDto> devices = new List <DeviceDto> { new DeviceDto { DisplayName = "Device 1" } }; var devicesClient = new FakeDevicesClient(devices); var measurementsClient = new FakeMeasurementsClient(); var statusClient = new FakeStatusClient(); var controller = new PowerController(devicesClient, measurementsClient, statusClient); // Act PowerControlResponse response = (PowerControlResponse)await controller.HandleAlexaRequest(request, null); // Assert Assert.IsNotNull(response); Assert.AreEqual("@Switch Turn On port-1", statusClient.SentMessage); }
// Use this for initialization void Start() { currentHP = startingHP; // Get controller of players hit ranger powerUp = null; }
private void OnGameBuilt(object sender) { floatingObject = GetComponent <FloatingObject>(); powerController = GetComponent <PowerController>(); powerController.EventPowerAttached += OnEventPowerAttached; game = GameObject.FindGameObjectWithTag(Tags.Game).GetComponent <Game>(); game.EventShipEliminated += OnShipEliminated; game.EventEnd += OnEventEnd; // Listen all event fights foreach (GameObject ship in game.ShipsInGame) { TailController tailController = ship.GetComponent <TailController>(); tailController.OnEventFight += OnEventFight; } gameObject.GetComponent <Tail>().OnEventOrbAttached += OnEventOrbAttached; // Attaching field of view notification GetComponentInChildren <AIFieldOfView>().EventOnFieldOfViewEnter += OnFieldOfViewEnter; checkpoints = new HashSet <GameObject>(GameObject.FindGameObjectsWithTag(Tags.AICheckpoint)); gameBuilt = true; }
public async Task ForSimpleDevice_SendsTurnsOn() { // Arrange string messageId = "Message12"; var request = BuildRequest(messageId, "TurnOff", "Endpoint1"); List <DeviceDto> devices = new List <DeviceDto> { new DeviceDto { DisplayName = "Device 1" } }; var devicesClient = new FakeDevicesClient(devices); var measurementsClient = new FakeMeasurementsClient(); var statusClient = new FakeStatusClient(); var controller = new PowerController(devicesClient, measurementsClient, statusClient); // Act PowerControlResponse response = (PowerControlResponse)await controller.HandleAlexaRequest(request, null); // Assert Assert.IsNotNull(response); Assert.AreEqual("@Switch Turn Off", statusClient.SentMessage); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Orb")) { PowerController powerController = other.GetComponent <PowerController>(); if (type == ElectricPylonType.Classic) { //if the electric pylon is not active and the orb is on fire, set the brazier on and activates the object if not null if (!isActive && powerController.elementalPower == GameManager.PowerType.Electric) { this.Activate(); } //if the electric pylon is active and the orb isn't (else refrech the duration of the power) else if (isActive) { powerController.ActivatePower(GameManager.PowerType.Electric, "forced"); } } if (type == ElectricPylonType.ArenaElectricPylon) { powerController.ActivatePower(GameManager.PowerType.Electric, "forced"); Deactivate(); StartCoroutine(ReActivateArenaElectricPylon()); } } }
private void Start() { controller = GameManager.gameManager.orb.GetComponent <PowerController>(); if (type == AltarType.AltarBoss) { anim = GetComponentInParent <Animator>(); } }
private void BuyPower() { if (ScoreController.Instance.CantTickets >= price) { PowerController.AddPower(1); ScoreController.Instance.CantTickets -= price; Refresh(); UpdateOthersButtons(); } }
private void HandleEvacuationDone(EvacuationDone message) { if (DataHolder.GetUtilization(message.SenderId) != UtilizationStates.Evacuating) { throw new NotImplementedException("Home come"); } PowerController.PowerOffHost(message.SenderId); //EvacuatingHost = 0; //EvacuatingHosts.Remove(message.SenderId); }
public void Create(Ship ship) { // instantiate the ship prefab var shipClone = Instantiate(_chassisPrefabs[ship.ChassisType]); shipClone.gameObject.name = ship.Name; ShipController shipController = shipClone.GetComponent <ShipController>(); shipController.InitializeFromStruct(ship, _chassisTypes[ship.ChassisType]); // initialise power plant PowerController powerController = shipClone.GetComponentInChildren <PowerController>(); powerController.InitializeFromStruct(ship.PowerPlant, _powerPlantTypes[ship.PowerPlant.PowerPlantType]); // instantiate each shield foreach (Shield shield in ship.Shields) { var shieldClone = Instantiate(_shieldPrefabs[shield.ShieldType]); ShieldController shieldController = shieldClone.GetComponent <ShieldController>(); shieldController.InitialiseFromStruct(shield, _shieldTypes[shield.ShieldType]); // attach to the right hardpoint -- TODO add checking here that the hardpoint exists var hardpoint = shipClone.transform.Find(shield.HardpointName); shieldClone.SetParent(hardpoint, false); } // instantiate each weapon foreach (Weapon weapon in ship.Weapons) { var weaponClone = Instantiate(_weaponPrefabs[weapon.WeaponType]); WeaponController weaponController = weaponClone.GetComponent <WeaponController>(); weaponController.InitialiseFromStruct(weapon, _weaponTypes[weapon.WeaponType]); // attach to the right hardpoint -- TODO add checking here that the hardpoint exists var hardpoint = shipClone.transform.Find(weapon.HardpointName); weaponClone.SetParent(hardpoint, false); } // instantiate offscreen indicator var offscreenIndicatorClone = Instantiate(OffscreenIndicatorPrefab); OffscreenIndicatorController offscreenIndicatorController = offscreenIndicatorClone.GetComponent <OffscreenIndicatorController>(); offscreenIndicatorController.Target = shipClone; offscreenIndicatorClone.SetParent(OffscreenIndicatorParent); shipController.OffscreenIndicator = offscreenIndicatorController; // set the layer int layer = ship.Faction == "Friendly" ? GameManager.PLAYER_LAYER : GameManager.ENEMY_LAYER; shipClone.gameObject.SetLayer(layer); }
void SetupTest() { MockedTimerAutomaticOff = new Mock <ITimer>(); TestTimers = new ControlTimers() { TimerAutomaticOff = MockedTimerAutomaticOff.Object }; TestPowerStatus = new PowerStatus(); TestPowerEventArgs = new PowerEventArgs(); TestPowerParameters = new PowerParameters(); TestPowerController = new PowerController(TestPowerParameters, TestTimers); }
private void btnLogin_Click(object sender, EventArgs e) { try { if (txtOperCode.Text == "") { MessageHelper.ShowError("请输入人员编号!"); txtOperCode.Focus(); return; } TS_OPERATOR oper = new TS_OPERATOR(); string operCode = txtOperCode.Text; string password = EncryptHelper.Encrypt(txtPassword.Text); using (PowerEntities powerdb = EntitiesFactory.CreatePowerInstance()) { oper = OperController.Login(powerdb, operCode, password); if (oper == null) { MessageHelper.ShowError("错误的用户名或密码,登录失败!"); txtOperCode.Focus(); txtOperCode.SelectAll(); return; } this.DialogResult = DialogResult.OK; //EntitiesFactory.SaveDb(powerdb); GlobalVar.Oper = oper; GlobalVar.PowerMenuList = PowerController.GetPowerMenuList(powerdb, GlobalVar.PortalCode, oper.OperCode); GlobalVar.NotifytypeList = PowerController.GetNotiFyTypeList(powerdb, GlobalVar.PortalCode, oper.OperCode); GlobalBuffer.FactoryCode = GlobalVar.Oper.DeptCode; } using (SpareEntities wmsdb = EntitiesFactory.CreateSpareInstance()) { OperLogController.AddLog(wmsdb, LogType.Login, oper.OperName, operCode, "登录成功"); EntitiesFactory.SaveDb(wmsdb); GlobalVar.InitGlobalVar(wmsdb, GlobalVar.Oper); } } catch (WmsException ex) { MessageHelper.ShowInfo(ex.ToString()); } catch (Exception ex) { var inner = ex.InnerException; MessageHelper.ShowError((string.IsNullOrEmpty(inner?.Message)) ? ex : inner); } }
// Use this for initialization void Start() { m_anim = GetComponent <Animator>(); m_resultTextController = FindObjectOfType <ResultTextController>(); m_powerController = FindObjectOfType <PowerController>(); m_damageImage = GameObject.Find("DamageImage"); m_damageImage.GetComponent <Image>().color = Color.clear; m_audioSource = GetComponent <AudioSource>(); m_buttonController = FindObjectOfType <ButtonController>(); }
//revenir au checkpoint public void MoveToCheckpoint() { transform.position = checkpoint; _rb2d.velocity = Vector3.zero; _tail.Clear(); if (powerController != null) { powerController.KillPower(); } onAction = false; powerController = null; }
public void Initialise(IComponentController powerController) { _powerController = (PowerController)powerController; _powerController.RegisterOnPowerChange(OnPowerChange); PowerNameLabel = transform.Find("EntryTitle").GetComponent <Text>(); PowerNameLabel.text = "Power"; // hard coded for now? RechargeLabel = transform.Find("RechargeRate").GetComponent <Text>(); RechargeLabel.text = string.Format("Rechg: ({0}/t)", _powerController.PowerPerTurn); PowerLevelLabel = transform.Find("PowerLevel").GetComponent <Text>(); PowerLevelLabel.text = string.Format("{0}/{1}", _powerController.CurrentPower, _powerController.MaxPower); }
private void OnGameBuilt(object sender) { game = GameObject.FindGameObjectWithTag(Tags.Game).GetComponent <Game>(); GameObject activePlayer = game.ActivePlayer; powerController = activePlayer.GetComponent <PowerController>(); powerController.EventPowerAttached += OnEventPowerAttached; ChangeAlphaColor(0f); builder.EventGameBuilt -= OnGameBuilt; game.EventEnd += OnEventEnd; game.EventShipEliminated += OnShipEliminated; }
/// <summary> /// Should Be Optimized for the reasons to add new host or remove one /// </summary> /// <param name="hostId"></param> /// <param name="atype"></param> protected void InitiateRejectAction(int hostId, StrategyActionType atype) { var action = RejectActions.Nothing; switch (atype) { case StrategyActionType.PushAction: if (DataHolder.GetUtilization(hostId) == UtilizationStates.UnderUtilization || DataHolder.GetUtilization(hostId) == UtilizationStates.Normal) { //throw new NotImplementedException("How come"); action = RejectActions.TestWalid; } else if (DataHolder.GetUtilization(hostId) == UtilizationStates.Evacuating) { action = RejectActions.CancelEvacuation; //UpdateSate(hostId, UtilizationStates.UnderUtilization,"Master"); DataHolder.SetUtilization(hostId, UtilizationStates.UnderUtilization); } else if (DataHolder.GetCandidateHosts(UtilizationStates.UnderUtilization, hostId).Count == 0 && DataHolder.GetCandidateHosts(UtilizationStates.Evacuating, hostId).Count == 0) { PowerController.PowerOnHost(); } else { //Should I cancell all evacuations } break; case StrategyActionType.PullAction: //Evacuate Host if (DataHolder.GetCandidateHosts(UtilizationStates.OverUtilization, hostId).Count == 0) { action = RejectActions.Evacuate; //UpdateSate(hostId, UtilizationStates.Evacuating, "Master"); DataHolder.SetUtilization(hostId, UtilizationStates.Evacuating); //evacuating.Add(hostId, DateTime.Now); } break; default: throw new ArgumentOutOfRangeException(); } RejectRequest request = new RejectRequest(hostId, this.MachineId, atype, action); CommunicationModule.SendMessage(request); }
void OnTriggerEnter(Collider col) { PowerController tempPUC = col.GetComponent <PowerController>(); if (tempPUC != null) { Debug.Log("Rapid Fire Power Up"); tempPUC.Append(powerup, powerup.colSource = col.gameObject); Destroy(gameObject); } }
public void Refresh() { if (ScoreController.Instance.CantTickets >= price) { button.interactable = true; } else { button.interactable = false; } textFrozen.text = PowerController.CantFrozen.ToString(); textBlock.text = PowerController.CantBlocks.ToString(); if (PowerController.IsFull()) { button.gameObject.SetActive(false); } }
/// <summary> /// Called whenever a new power up is acquired. /// </summary> /// <param name="sender"></param> private void OnPowerAcquired(PowerController sender) { power = sender.PowerUp; if (power != null) { renderer_component.sprite = power.icon; renderer_component.enabled = true; power.DestroyedEvent += OnPowerUpDestroyed; } else { renderer_component.enabled = false; } }
void Start() { // カーソルを自前のカーソルに変更 Cursor.SetCursor(cursor, new Vector2(cursor.width / 2, cursor.height / 2), CursorMode.ForceSoftware); //MaxEnemyの値の取得 m_enemyGenerator = FindObjectOfType <EnemyGenerator>(); m_maxEnemy = m_enemyGenerator.MaxEnemy; m_resultTextController = FindObjectOfType <ResultTextController>(); m_powerController = FindObjectOfType <PowerController>(); m_audioSource = GetComponent <AudioSource>(); m_buttonController = FindObjectOfType <ButtonController>(); }
public void LootEnemy() { if (Random.Range(0.0f, 1.0f) <= chanceOfHealing) { GameManager.gameManager.spawnHealingOrbs(0, healAmount, "normal"); } if (Random.Range(0.0f, 1.0f) <= chanceOfPowerDrop && GameManager.gameManager.orb.GetComponent <PowerController>().droppedPower == GameManager.PowerType.None) { soundEmitter.PlaySound(2, true); PowerController controller = GameManager.gameManager.orb.GetComponent <PowerController>(); controller.droppedPower = droppedPower; controller.reflectedDrop = false; GameManager.gameManager.UIManager.UpdateDroppedPower(droppedPower); } }
protected void Awake() { sRender = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); impulseSource = GetComponent <CinemachineImpulseSource>(); attackTimer = attackInterval; canAttack = true; weaponPoint = GameObject.FindGameObjectWithTag("WeaponPoint").GetComponent <WeaponPoint>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); powerController = GameObject.FindGameObjectWithTag("UI_PowerBar").GetComponent <PowerController>(); if (castor == null) { castor = GameObject.FindGameObjectWithTag("PlayerStateController").GetComponent <PlayerStateController>(); } }
public void Start() { Ship.ShipCreatedEvent += OnShipCreated; Ship.ShipDestroyedEvent += OnShipDestroyed; floatingObject = GetComponent <FloatingObject>(); powerController = GetComponent <PowerController>(); powerController.PowerAcquiredEvent += OnEventPowerAttached; GetComponent <FightController>().FightEvent += OnEventFight; GetComponent <Ship>().OrbAttachedEvent += OnEventOrbAttached; GetComponentInChildren <AIFieldOfView>().EventOnFieldOfViewEnter += OnFieldOfViewEnter; checkpoints = new HashSet <GameObject>(GameObject.FindGameObjectsWithTag(Tags.AICheckpoint)); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Orb")) { PowerController orbPower = other.gameObject.GetComponent <PowerController>(); if (orbPower.elementalPower == GameManager.PowerType.Fire) { if (!isActive) { this.Activate(); } } // else if (isBurning) // { // orbPower.ActivatePower(GameManager.PowerType.Fire, "forced"); // } } }