public void BeginReading () { src = GetComponent<CardboardAudioSource> (); gc = (GameController) FindObjectOfType(typeof(GameController)); lc = (LightController) FindObjectOfType(typeof(LightController)); src.Play (); lc.holy = true; StartCoroutine ("FinishReading"); }
void Start() { _playerRigidbody = GameObject.Find("Player").GetComponent<Rigidbody2D>(); _playerLight = _playerRigidbody.GetComponentInChildren<LightController>(); _myRigidbody = this.GetComponent<Rigidbody2D>(); _myLight = this.GetComponentInChildren<LightController>(); UpdateMyRandomValue(); }
// Flicker Light Subrotine. IEnumerator flickerToOff(LightController light) { yield return new WaitForSeconds(0.05f); light.ChangeStatusTo(LightController.LightStatus.On); //On yield return new WaitForSeconds(0.1f); light.ChangeStatusTo(LightController.LightStatus.Dimmed); //Disabled yield return new WaitForSeconds(0.05f); light.ChangeStatusTo(LightController.LightStatus.On); //On yield return new WaitForSeconds(0.1f); light.ChangeStatusTo(LightController.LightStatus.Dimmed); //Disabled }
// Use this for initialization void Start() { blackscreen.SetActive(false); Time.timeScale = 1; Cursor.visible = false; objectiveText.text = "Find the main entrance"; RenderSettings.ambientIntensity = 0.2f; _ac = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioControl>(); _enemy = GameObject.FindGameObjectWithTag("Enemy").GetComponent<EnemyController>(); _LightControl = this.gameObject.GetComponent<LightController>(); _triggerZoneManagement = this.gameObject.GetComponent<EyeRayCaster>(); _key = false; FiredEvents = 0; FiredKeyEvents = 0; }
// Use this for initialization void Start() { if (digitPlace > 3 || digitPlace < 1) { throw new System.ArgumentOutOfRangeException("digitPlace"); } foreach (LightController lightObject in GetComponentsInChildren<LightController>()) { switch (lightObject.digitLight) { case LightController.DigitLight.Top: this.top = lightObject; break; case LightController.DigitLight.TopLeft: this.topLeft = lightObject; break; case LightController.DigitLight.TopRight: this.topRight = lightObject; break; case LightController.DigitLight.Middle: this.middle = lightObject; break; case LightController.DigitLight.BottomLeft: this.bottomLeft = lightObject; break; case LightController.DigitLight.BottomRight: this.bottomRight = lightObject; break; case LightController.DigitLight.Bottom: this.bottom = lightObject; break; } } lightMap = new HashSet<LightController>[] { /* 0 */ new HashSet<LightController>() { top, topLeft, topRight, bottomLeft, bottomRight, bottom } /* 1 */ , new HashSet<LightController>() { topRight, bottomRight } /* 2 */ , new HashSet<LightController>() { top, topRight, middle, bottomLeft, bottom } /* 3 */ , new HashSet<LightController>() { top, topRight, middle, bottomRight, bottom } /* 4 */ , new HashSet<LightController>() { topLeft, topRight, middle, bottomRight } /* 5 */ , new HashSet<LightController>() { top, topLeft, middle, bottomRight, bottom } /* 6 */ , new HashSet<LightController>() { top, topLeft, middle, bottomLeft, bottomRight, bottom } /* 7 */ , new HashSet<LightController>() { top, topRight, bottomRight } /* 8 */ , new HashSet<LightController>() { top, topLeft, topRight, middle, bottomLeft, bottomRight, bottom } /* 9 */ , new HashSet<LightController>() { top, topLeft, topRight, middle, bottomRight } }; }
static void Main(string[] args) { var lightController = new LightController(); Console.WriteLine("Press Enter to turn ON the light"); lightController.TurnLight(true); Console.ReadLine(); Console.WriteLine("Press Enter to turn OFF the light"); lightController.TurnLight(false); Console.ReadLine(); Console.WriteLine("Press Enter to turn ON the light"); lightController.TurnLight(true); Console.ReadLine(); Console.WriteLine("Press Enter to turn OFF the light"); lightController.TurnLight(false); Console.ReadLine(); }
public void Create_CreateItem_CorrectObjectInputFourthArg_ExpectedResult_True() { using (_context = new FwpsDbContext(_options)) { _context.Database.EnsureCreated(); _lc = new LightController(_context, _hub); _li.Command = "ThirdArg"; _lc.Create(_li); _hub.Clients.All.Received(1).InvokeAsync( Arg.Any <string>(), Arg.Any <string>(), Arg.Any <string>(), Arg.Is <LightItem>(fourthArg => fourthArg == _li) ); } }
public ELT() { //debug variable is_debug = true; //starting FSI Client for IRS FSIcm.inst.OnVarReceiveEvent += fsiOnVarReceive; FSIcm.inst.DeclareAsWanted(new FSIID[] { FSIID.MBI_ELT_ARM_SWITCH } ); //standard values LightController.set(FSIID.MBI_ELT_ACTIVE_LIGHT, false); FSIcm.inst.MBI_ELT_LAMPTEST = false; FSIcm.inst.ProcessWrites(); }
/// <summary> /// Lukee tekstitiedoston. /// </summary> /// <param name="textToLoad"></param> /// public bool ReloadDialogue(TextAsset textToLoad) { if (textToLoad == null) { if (currentObject.tag == "lightswitch") { LightController controller = currentObject.GetComponent <LightController>(); controller.SwitchLights(); return(false); } Debug.Log("Text file not found"); return(false); } choiceCount = textToLoad.text.Count(x => x.Equals('*')); textLines = new string[1]; textLines = (textToLoad.text.Split('\n')); charLine = new char[1]; charLine = textLines[currentLine].ToCharArray(); return(true); }
public override void OnCreate() { base.OnCreate(); btsAnswer.button.onClick.AddListener(OnClickAnswer); btsRandom.button.gameObject.SetActive(false); btsChioce.button.onClick.AddListener(OnClickChioce); btsRandom.button.onClick.AddListener(OnClickRandom); btsVideo.button.onClick.AddListener(OnClickVideo); btsLightExam.button.onClick.AddListener(OnClickExam); btsRules.button.onClick.AddListener(OnClickRules); btsNext.button.onClick.AddListener(OnClickNext); btnHelp.onClick.AddListener(OnClickHelp); btnReturn.onClick.AddListener(() => { IsShowVideo = false; CleanQuestion(); CloseAllLight(); SwitchSceneMgr.Instance.SwitchToMain(); }); lightController = FindObjectOfType <LightController>(); if (lightController == null) { Debug.LogError("ERROR:ILightController is lost"); } //#if CHAPTER_ONE // List<VideoData> videoDatas = ConfigDataMgr.Instance.GetVideoList(GameDataMgr.Instance.carType); // btsVideo.button.gameObject.SetActive(videoDatas.Count > 0); // examTip = GameDataMgr.Instance.carVersion == CarVersion.NEW ? ConfigDataMgr.Instance.gameConfig.examtip_new : ConfigDataMgr.Instance.gameConfig.examtip_old; //#elif CHAPTER_TWO btsVideo.button.gameObject.SetActive(GameDataMgr.Instance.carInfo.listvideo.Count > 0); examTip = new ExamTipData() { exam_audio = GameDataMgr.Instance.carInfo.TypeModel.examaudio, broadcast_end = GameDataMgr.Instance.carInfo.TypeModel.broadcastend.Trim(), exam_tip = GameDataMgr.Instance.carInfo.TypeModel.examtip }; //#endif }
private void Update() { RaycastHit hit; Vector3 horizontal = transform.right * Input.GetAxisRaw("Horizontal"); Vector3 verticale = transform.forward * Input.GetAxisRaw("Vertical"); Vector3 velocity = (horizontal + verticale).normalized * speed; Vector3 rotation = new Vector3(0, Input.GetAxisRaw("Mouse X"), 0) * mouseXSensitivity; float camRotation = Input.GetAxisRaw("Mouse Y") * mouseYSensitivity; // Set Player velocity and rotation in Engine if (!freeze) { pEngine.SetVelocity(velocity); pEngine.SetRotation(rotation, camRotation); } else { pEngine.SetVelocity(Vector3.zero); pEngine.SetRotation(Vector3.zero, 0); } if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, 3, mask) && Input.GetKeyDown(KeyCode.E)) { LightController lamp = hit.collider.gameObject.GetComponent <LightController>(); GameObject task = GetTaskByName(lamp._task); if (task == null || lamp.IsActive() || task.activeInHierarchy) { return; } //Prepare user for interface freeze = true; Cursor.visible = true; Debug.Log("Activate task: " + task.name); task.SetActive(true); // Wait for finish StartCoroutine(WaitComplete(lamp, task)); } }
// Use this for initialization void Start() { // Set jack name gameObject.name = "Jack_" + Id; if (!Board) { GameObject goBoard = GameObject.Find("switchboard"); Switchboard brd = goBoard.GetComponent <Switchboard>(); if (brd) { _board = brd; } } _board.RegisterJack(this); _lightControl = GetComponent <LightController>(); _audioSource = GetComponent <AudioSource>(); // Subscribe to snapzone events _snapDropZone = GetComponentInChildren <VRTK_SnapDropZone>(); _snapDropZone.ObjectSnappedToDropZone += new SnapDropZoneEventHandler(OnSnap); _snapDropZone.ObjectUnsnappedFromDropZone += new SnapDropZoneEventHandler(OnUnsnap); }
protected void Awake() { if (Instance == null) { Instance = this; } else { Debug.LogErrorFormat("Duplicated {0} found in object {1}", GetType().Name, name); Destroy(this); return; } _tintAmountId = Shader.PropertyToID("_TintAmount"); _textureId = Shader.PropertyToID("_MainTex"); _texture2Id = Shader.PropertyToID("_TintTex"); _tintColorId = Shader.PropertyToID("_TintColor"); tintedSkyboxMaterial = Instantiate(tintedSkyboxMaterial); // to avoid material modifications in editor mixedSkyboxMaterial = Instantiate(mixedSkyboxMaterial); // to avoid material modifications in editor lightRotation = new AnimatedProperty <Quaternion>(this, lightTransform.localRotation, smoothCurve, Quaternion.Lerp, (q, p) => lightTransform.localRotation = q, (a, b) => a == b); lightColor = new AnimatedProperty <Color>(this, directionalLight.color, smoothCurve, Color.Lerp, (c, p) => directionalLight.color = c, (a, b) => a == b); lightIntensity = new AnimatedProperty <float>(this, directionalLight.intensity, smoothCurve, Mathf.Lerp, (i, p) => directionalLight.intensity = i, (a, b) => Mathf.Abs(a - b) < Mathf.Epsilon); fogDensity = new AnimatedProperty <float>(this, 0f, smoothCurve, Mathf.Lerp, (f, p) => UpdateFogAndCamera(f), (a, b) => Mathf.Abs(a - b) < Mathf.Epsilon); fogColor = new AnimatedProperty <Color>(this, Color.black, smoothCurve, Color.Lerp, (c, p) => RenderSettings.fogColor = c, (a, b) => a == b); skybox = new AnimatedProperty <Texture>(this, null, smoothCurve, LerpSkyboxes, UpdateSkybox, (a, b) => a == null ? b == null : a.Equals(b)); mainCamera = Camera.main; skyColor = new AnimatedProperty <Color>(this, Color.black, smoothCurve, Color.Lerp, (c, p) => { mainCamera.backgroundColor = c; tintedSkyboxMaterial.SetColor(_tintColorId, c); }, (a, b) => a == b); _minVisibilityLog = Mathf.Sqrt(-Mathf.Log(1f - fogIntensityOnFarPlane)); RenderSettings.fog = false; _fog = false; RenderSettings.fogMode = FogMode.ExponentialSquared; }
public void Update_UpdateItem_ExpectedResult_CommandUpdated() { using (_context = new FwpsDbContext(_options)) { long id = 2; _li.Id = id; _context.Database.EnsureCreated(); _li2.Command = "SecondItem"; _lc = new LightController(_context, _hub); _lc.Create(_li2); _li.Command = "FirstItem"; _lc.Update(id, _li); Assert.That(_context.LightItems. ToList()[1].Command, Is.EqualTo("FirstItem")); } }
public FUEL() { //debug variable is_debug = true; //starting FSI Client for IRS FSIcm.inst.OnVarReceiveEvent += fsiOnVarReceive; FSIcm.inst.DeclareAsWanted(new FSIID[] { FSIID.MBI_FUEL_CROSSFEED_SWITCH, FSIID.MBI_FUEL_CTR_LEFT_PUMP_SWITCH, FSIID.MBI_FUEL_CTR_RIGHT_PUMP_SWITCH, FSIID.MBI_FUEL_LEFT_AFT_PUMP_SWITCH, FSIID.MBI_FUEL_LEFT_FWD_PUMP_SWITCH, FSIID.MBI_FUEL_RIGHT_AFT_PUMP_SWITCH, FSIID.MBI_FUEL_RIGHT_FWD_PUMP_SWITCH } ); //standard values LightController.set(FSIID.MBI_FUEL_CROSSFEED_VALVE_OPEN_LIGHT, false); LightController.set(FSIID.MBI_FUEL_CTR_LEFT_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_CTR_RIGHT_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_LEFT_AFT_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_LEFT_ENG_VALVE_CLOSED_LIGHT, true); LightController.set(FSIID.MBI_FUEL_LEFT_FILTER_BYPASS_LIGHT, false); LightController.set(FSIID.MBI_FUEL_LEFT_FWD_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_LEFT_SPAR_VALVE_CLOSED_LIGHT, true); LightController.set(FSIID.MBI_FUEL_RIGHT_AFT_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_RIGHT_ENG_VALVE_CLOSED_LIGHT, true); LightController.set(FSIID.MBI_FUEL_RIGHT_FILTER_BYPASS_LIGHT, false); LightController.set(FSIID.MBI_FUEL_RIGHT_FWD_PUMP_LOW_PRESSURE_LIGHT, true); LightController.set(FSIID.MBI_FUEL_RIGHT_SPAR_VALVE_CLOSED_LIGHT, true); FSIcm.inst.MBI_FUEL_LAMPTEST = false; FSIcm.inst.ProcessWrites(); }
public void SetRoom() { gameManager = FindObjectOfType <GameManager>(); for (int i = 0; i < transform.childCount; i++) { GameObject obj = transform.GetChild(i).gameObject; if (obj.CompareTag("Appliance")) { ApplianceController ac = obj.GetComponent <ApplianceController>(); applianceList.Add(ac); ac.SetCurrentAppliance(ac.applianceTree[0]); } else if (obj.CompareTag("Light")) { LightController lb = obj.GetComponent <LightController>(); lightList.Add(lb); lb.SetLightBulb(gameManager.incandescentLight); } } }
public AIRCOND() { //debug variable is_debug = true; //starting FSI Client for IRS FSIcm.inst.OnVarReceiveEvent += fsiOnVarReceive; /*FSIcm.inst.DeclareAsWanted(new FSIID[] * { * FSIID.MBI_ELT_ARM_SWITCH * } * );*/ //standard values LightController.set(FSIID.MBI_AIR_COND_CONT_CAB_ZONE_TEMP_LIGHT, false); LightController.set(FSIID.MBI_AIR_COND_AFT_CAB_ZONE_TEMP_LIGHT, false); LightController.set(FSIID.MBI_AIR_COND_FWD_CAB_ZONE_TEMP_LIGHT, false); FSIcm.inst.MBI_AIR_COND_LAMPTEST = false; FSIcm.inst.ProcessWrites(); }
public bool CheckIfLightsAreOn(LightController lightController) { //if more than 50 % of the lights are on this will return true float totalLights = 0; float totalEnabled = 0; foreach (GameObject light in lightController.lights) { totalLights += 1; if (light.GetComponentInChildren <Light>().enabled) { totalEnabled += 1.0f; } } if (totalEnabled >= Mathf.Ceil(totalLights / 2)) { return(true); } else { return(false); } }
public void sayNo() { switch (type) { case DialogType.DIALOG_TYPE_PRINCESS_START: ConfigController.firstDialog = false; RightPath(); break; case DialogType.DIALOG_TYPE_END_GAME: panel.SetActive(false); buttons[0].SetActive(false); buttons[1].SetActive(false); bossController.spawnBoss(); LightController.SwapLight(false); CinematicController.startCinematic(); SaveController.SavePoint(ConfigController.phase, 0, 0, 0, 0, 0); break; case DialogType.DIALOG_TYPE_TRUE_END_GAME: panel.SetActive(false); buttons[0].SetActive(false); buttons[1].SetActive(false); LightController.SwapLight(true); break; case DialogType.DIALOG_TYPE_EXIT_GAME: panel.SetActive(false); buttons[0].SetActive(false); buttons[1].SetActive(false); break; default: break; } }
void Start() { m_ai = GameObject.FindGameObjectWithTag("AI"); m_lightController = m_ai.GetComponent <LightController>(); }
public abstract bool CanChangeStateOf(LightController controller);
// Use this for initialization void Start() { // Get the LightController component on the second child of this Game Object _control = transform.GetChild (1).GetComponent<LightController> () as LightController; }
// Use this for initialization void Start() { lightController = new LightController(); lightController.LightIsLit += lightController_LightIsLit; }
void OnTriggerStay2D(Collider2D interact) { if (interact.gameObject.tag == "OSTCHANGER") { OST_BackgroundChanger backOSTChanger = interact.GetComponent <OST_BackgroundChanger>(); if (backOSTChanger.isCave) { backOSTChanger.caveOST.GetComponent <OSTcontroller>().audioSource.volume = 0.5f; //Color color = backOSTChanger.backgroundCave.GetComponent<SpriteRenderer>().material.color; //color.a += 1 * Time.deltaTime; //if(color.a < 1) //{ // backOSTChanger.backgroundCave.GetComponent<SpriteRenderer>().material.color = color; //} //Color color2 = backOSTChanger.backgroundCave.GetComponent<SpriteRenderer>().material.color; //color2.a -= 1 * Time.deltaTime; //if (color2.a > 0) //{ // backOSTChanger.backgroundForest.GetComponent<SpriteRenderer>().material.color = color2; //} backOSTChanger.forestOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; backOSTChanger.castleOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; } if (backOSTChanger.isForest) { backOSTChanger.caveOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; //Color color = backOSTChanger.backgroundForest.GetComponent<SpriteRenderer>().material.color; //color.a += 1 * Time.deltaTime; //if (color.a < 1) //{ // backOSTChanger.backgroundForest.GetComponent<SpriteRenderer>().material.color = color; //} //Color color2 = backOSTChanger.backgroundCave.GetComponent<SpriteRenderer>().material.color; //color2.a -= 1 * Time.deltaTime; //if (color2.a > 0) //{ // backOSTChanger.backgroundCave.GetComponent<SpriteRenderer>().material.color = color2; //} backOSTChanger.forestOST.GetComponent <OSTcontroller>().audioSource.volume = 0.5f; backOSTChanger.castleOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; } if (backOSTChanger.isCastle) { backOSTChanger.caveOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; backOSTChanger.forestOST.GetComponent <OSTcontroller>().audioSource.volume = 0f; backOSTChanger.castleOST.GetComponent <OSTcontroller>().audioSource.volume = 0.5f; } } if (interact.gameObject.tag == "Itens" || interact.gameObject.tag == "NPC") { if (input.interactPressed) { infoText.SetActive(false); } } if (interact.gameObject.tag == "Lights") { LightController lightControl = interact.GetComponent <LightController>(); if (lightControl.lightsOn) { if (lightControl.light.GetComponent <Light>().intensity <= lightControl.intensity) { lightControl.light.GetComponent <Light>().intensity += 0.5f * Time.deltaTime; } //lightControl.light.SetActive(true); } else if (!lightControl.lightsOn) { if (lightControl.light.GetComponent <Light>().intensity >= lightControl.minimum) { lightControl.light.GetComponent <Light>().intensity -= 0.5f * Time.deltaTime; } //lightControl.light.SetActive(false); } } }
void Awake() { if (CurrentCharacterType == CharacterType.Marlon) NumberOfSections = 7.0f; else if (CurrentCharacterType == CharacterType.Isaac) NumberOfSections = 5.0f; else if (CurrentCharacterType == CharacterType.Felix) NumberOfSections = 9.0f; #region DeviceResolution if (CurrentPhoneType == PhoneTypes.UNIDENTIFIED && Camera.main != null) { float currentAspect = Camera.main.aspect; //Galaxy S7 if (currentAspect == 1440f / 2560f) { CurrentPhoneType = PhoneTypes.GALAXYS7; } //iPhone6 if (currentAspect == 750 / 1334) { CurrentPhoneType = PhoneTypes.IPHONE6; } //iPhone5 if (currentAspect == 640 / 1136) { CurrentPhoneType = PhoneTypes.IPHONE5; } //iPhone4 if (currentAspect == 640 / 960) { CurrentPhoneType = PhoneTypes.IPHONE4; } } #endregion //Mason: Temp solution to test transition between phone and game scenes without character select. If you are seeing this, please feel free to remove. //Ashlyn: This is ok, just comment stuff like this out before making commits. //CurrentCharacterType = CharacterType.Marlon; //CurrentConvoIndex = 0; //CurrentCharacterConvo = CharacterConvo.Mom; /*TransitionScreen.SetActive (true); TransitionScreen.GetComponent<CanvasGroup> ().alpha = 1f;*/ if (SceneManager.GetActiveScene ().name == "Prioritizing") { GameObject instructions = Instantiate (CollectDiamond, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject; _currentInstructions = instructions.GetComponent<SpriteRenderer> (); if (CurrentCharacterType == CharacterType.Felix) { if (CurrentConvoIndex == 1) { FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 1-1"); } if (CurrentConvoIndex == 2) { FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 2-1"); } if (CurrentConvoIndex == 3) { FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 3-1"); } } if (CurrentCharacterType == CharacterType.Marlon) { if (CurrentConvoIndex == 5) { FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 1-1"); } else if (CurrentConvoIndex == 6) { FindObjectOfType<BackgroundManager> ().AddNewSegment ("Level 3-1"); } } } if (SceneManager.GetActiveScene ().name == "RoomEscape") { GameObject instructions = Instantiate (GetBone, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject; _currentInstructions = instructions.GetComponent<SpriteRenderer> (); GameObject currentRELevel = null; if (CurrentCharacterType == CharacterType.Marlon) { if (CurrentConvoIndex == 0) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1); else if (CurrentConvoIndex == 1) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 3); else if (CurrentConvoIndex == 2) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 4); } if (CurrentCharacterType == CharacterType.Isaac) { if (CurrentConvoIndex == 0) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 3); else if (CurrentConvoIndex == 1) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 4); else if (CurrentConvoIndex == 2) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1); } if (CurrentCharacterType == CharacterType.Felix) { if (CurrentConvoIndex == 4) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 5); else if (CurrentConvoIndex == 5) currentRELevel = Resources.Load<GameObject> ("Prefabs/Minigames/RoomEscape/Level " + 1); } Instantiate (currentRELevel, currentRELevel.transform.position, Quaternion.identity); } if (SceneManager.GetActiveScene ().name == "Irritation") { GameObject instructions = Instantiate (ProtectCookie, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject; _currentInstructions = instructions.GetComponent<SpriteRenderer> (); } if (SceneManager.GetActiveScene ().name == "FindingFriends") { GameObject fFLevel = new GameObject (); if (CurrentCharacterType == CharacterType.Marlon) { if (CurrentConvoIndex == 3) fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Hard"); if (CurrentConvoIndex == 4) fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Easy"); } else if (CurrentCharacterType == CharacterType.Isaac) { if (CurrentConvoIndex == 2) fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Hard"); if (CurrentConvoIndex == 3) fFLevel = Resources.Load<GameObject> ("Prefabs/Minigames/FindingFriends/Level 1 Easy"); } fFLevel = (GameObject)Instantiate (fFLevel, fFLevel.transform.position, Quaternion.identity); _fireflyLightRenderer = GameObject.Find ("Player").GetComponentInChildren<MeshRenderer> (); _playerLightController = _fireflyLightRenderer.gameObject.GetComponent<LightController> (); _fireflyLightRenderer.enabled = false; _playerLightController.enabled = false; GameObject instructions = Instantiate (FindFF, new Vector3 (Camera.main.transform.position.x, Camera.main.transform.position.y, 1), Quaternion.identity) as GameObject; _currentInstructions = instructions.GetComponent<SpriteRenderer> (); } }
// Use this for initialization void Start() { ScoreObj = GameObject.FindGameObjectWithTag ("SCORESYSTEM"); sys = ScoreObj.GetComponent<Scoresystem> () as Scoresystem; control = LightObject.GetComponent<LightController> () as LightController; }
// Use this for initialization void Start() { player = GameObject.Find("Player").transform; eventHandler = GameObject.Find("Game Manager").GetComponent<EventHandler>(); hasRun = false; run = false; repeatDelay = 0; if (trigger == triggerType.LIGHTS) { lightController = gameObject.GetComponent<LightController>(); isRepeatable = true; repeatDelay = 10; activationDistMin = 0; activationDistMax = 10; } else if (trigger == triggerType.SMOKE) { isRepeatable = true; repeatDelay = 10; activationDistMin = 0; activationDistMax = 10; } else if (trigger == triggerType.CRATES) { isRepeatable = false; activationDistMin = 5; activationDistMax = 10; } else if (trigger == triggerType.SPAWN) { isRepeatable = true; repeatDelay = 30; activationDistMin = 10; activationDistMax = 20; } }
IEnumerator turnLightOn(LightController light) { yield return(new WaitForSeconds(0)); light.TurnLightOn(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { LightController light = new LightController(zone.MyLight); }
public void CmdChangeLightStatus(GameObject LightCtrl, LightController.LightStatus NxtStatus) { LightCtrl.GetComponent<LightController>().ChangeStatusTo(NxtStatus); }
void Start() { worldLight = GameObject.Find("WorldLight").GetComponent<Light>(); lightTorch = playerCharacter.transform.FindChild("light").GetComponent<Light>(); lightLarger = lightTorch.transform.FindChild("lightLarge").GetComponent<Light>(); instance = this; }
// Use this for initialization void Start() { lightControl = mainLight.GetComponent<LightController>(); selfLight = GetComponent<LightController>(); }
IEnumerator turnLightOff(LightController light) { yield return(new WaitForSeconds(0)); StartCoroutine(turnLightOff(light, 1)); }
void Start() { rotationSpeed *= LevelFinishedController.instance.gameSpeed; instance = this; }
IEnumerator turnLightOn(LightController light, float delay) { yield return(new WaitForSeconds(delay)); light.TurnLightOn(); }
protected virtual void OnLightStateChanged(LightController newLight) { LightStateChanged?.Invoke(this, new LightStateChangedEventArgs(newLight.Config.Name, newLight.IsOn)); }
void Start() { vp = GetComponent <VehicleParent>(); lg = GetComponent <LightController> (); engine = vp.engine; }
void Awake() { S = this; }
void Update() { mLineRenderer.SetPosition(0, barrel.position); RaycastHit2D hit = Physics2D.Linecast(barrel.position, laserDirection.position, untraversableLayers); if (hit.collider != null && !hit.collider.gameObject.layer.Equals(9)) { dotsight.transform.position = hit.point; mLineRenderer.SetPosition(1, hit.point); lightning.EndPosition = hit.point; mTarget = hit.transform; } else { mLineRenderer.SetPosition(1, laserDirection.position); dotsight.transform.position = laserDirection.position; lightning.EndPosition = laserDirection.position; mTarget = null; } if (!player.controlling) { float a = Input.GetAxis("HorizontalGun"); float b = Input.GetAxis("VerticalGun"); float c = Mathf.Sqrt(Mathf.Pow(a, 2) + Mathf.Pow(b, 2)); //rotazione della pistola if (Mathf.Abs(c) < 0.5f) { mLineRenderer.material = idleMaterial; dotsight.GetComponent <SpriteRenderer>().enabled = false; isAiming = false; } else { mLineRenderer.material = aimMaterial; if (hasGun) { dotsight.GetComponent <SpriteRenderer>().enabled = true; } isAiming = true; } if (Mathf.Abs(c) > 0.9 && !isLocked) { float angleRot = -Mathf.Sign(b) * Mathf.Rad2Deg * Mathf.Acos(a / c); mTransform.rotation = Quaternion.Euler(0f, 0f, angleRot); //mantiene la sprite dell'arma nel verso giusto if (mTransform.rotation.eulerAngles.z % 270 < 90 && mTransform.rotation.eulerAngles.z % 270 >= 0) { GetComponent <SpriteRenderer>().flipY = false; arm.flipX = false; armShadow.flipX = false; transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>().flipY = false; } else { GetComponent <SpriteRenderer>().flipY = true; arm.flipX = true; armShadow.flipX = true; transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>().flipY = true; } } if (hasGun && canFire && Input.GetButtonDown("Fire1")) { isLocked = true; SoundManager.Instance.EmptyGunshot(); lightning.Trigger(); mLineRenderer.enabled = false; if (mTarget != null) { if (mTarget.CompareTag(Tags.light)) { LightController currentLight = mTarget.GetComponent <LightController>(); if (InLineOfSight(mTarget.GetComponent <Collider2D>()) && !currentLight.changingStatus) { if ((currentLight.lightStatus && (maxCharge - currentCharge) >= currentLight.lightCharge) || (!currentLight.lightStatus && currentCharge >= currentLight.lightCharge)) { mTarget.GetComponent <LightController>().SwitchOnOff(transform); if (currentLight.lightStatus) { lightningCoroutine = StartCoroutine(LightningEffectOn(mTarget.GetComponent <LightController>().switchTime, true)); StartCoroutine("TrailingEffectOff", mTarget.GetComponent <LightController>().switchTime); } else { lightningCoroutine = StartCoroutine(LightningEffectOn(mTarget.GetComponent <LightController>().switchTime, false)); StartCoroutine("TrailingEffectOn", mTarget.GetComponent <LightController>().switchTime); } //isLocked = true; } } } else if (mTarget.CompareTag(Tags.machinery)) { MachineryController currentMachinery = mTarget.GetComponent <MachineryController>(); if (InLineOfSight(mTarget.GetComponent <Collider2D>()) && !currentMachinery.changingStatus) { if ((currentMachinery.powered && (maxCharge - currentCharge) >= currentMachinery.powerCharge) || (!currentMachinery.powered && currentCharge >= currentMachinery.powerCharge)) { currentMachinery.SwitchOnOff(transform); if (currentMachinery.powered) { lightningCoroutine = StartCoroutine(LightningEffectOn(mTarget.GetComponent <MachineryController>().switchTime, true)); StartCoroutine("TrailingEffectOff", mTarget.GetComponent <MachineryController>().switchTime); } else { lightningCoroutine = StartCoroutine(LightningEffectOn(mTarget.GetComponent <MachineryController>().switchTime, false)); StartCoroutine("TrailingEffectOn", mTarget.GetComponent <MachineryController>().switchTime); } //isLocked = true; } } } else if (mTarget.CompareTag(Tags.enemy)) { enemyControlled = mTarget.GetComponent <EnemyController>(); if (InLineOfSight(mTarget.GetComponent <Collider2D>()) && currentCharge >= enemyControlled.controlCost) { enemyControlled.ControlledOn(transform); lightningCoroutine = StartCoroutine(LightningEffectOn(mTarget.GetComponent <EnemyController>().switchTime, false)); StartCoroutine("TrailingEffectOn", mTarget.GetComponent <EnemyController>().switchTime); //isLocked = true; } } } } if (hasGun && Input.GetButtonUp("Fire1")) { isLocked = false; mLineRenderer.enabled = true; if (lightningCoroutine != null) { StopCoroutine(lightningCoroutine); } StopCoroutine("TrailingEffectOn"); StopCoroutine("TrailingEffectOff"); SoundManager.Instance.GunshotStop(); Destroy(particleEffect); } } else if (mLineRenderer.material != idleMaterial) { mLineRenderer.material = idleMaterial; } if (hasGun && Input.GetButtonUp("Fire1")) { mLineRenderer.enabled = true; } }
// Use this for initialization void Start() { readyToTurnOff = new bool[numButtons]; for (int i = 0; i < numButtons; i++) { readyToTurnOff[i] = true; } buttonTimerInProgress = new bool[numButtons]; buttonIsStepped = new bool[numButtons]; soundMgr = GameObject.Find ("Sound Manager").GetComponent<SoundManager>(); lightCtrl = GameObject.Find ("Light Controller").GetComponent<LightController> (); serialInput = GameObject.Find ("MK").GetComponent<SerialInputController> (); states = new State[numStates]; for (int i = 0; i < numStates; i++) { states[i] = new State(i); } FlashAllUnplayedButtons (); }
void fsiOnVarReceive(FSIID id) { //CROSSFEED if (id == FSIID.MBI_FUEL_CROSSFEED_SWITCH) { if (FSIcm.inst.MBI_FUEL_CROSSFEED_SWITCH) { debug("FUEL Crossfeed On"); } else { debug("FUEL Crossfeed Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_CROSSFEED_VALVE_OPEN_LIGHT, FSIcm.inst.MBI_FUEL_CROSSFEED_SWITCH); LightController.ProcessWrites(); } //FUEL CTR L if (id == FSIID.MBI_FUEL_CTR_LEFT_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_CTR_LEFT_PUMP_SWITCH) { debug("FUEL CTR LEFT PUMP On"); } else { debug("FUEL CTR LEFT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_CTR_LEFT_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_CTR_LEFT_PUMP_SWITCH); LightController.ProcessWrites(); } //FUEL CTR R if (id == FSIID.MBI_FUEL_CTR_RIGHT_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_CTR_RIGHT_PUMP_SWITCH) { debug("FUEL CTR RIGHT PUMP On"); } else { debug("FUEL CTR RIGHT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_CTR_RIGHT_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_CTR_RIGHT_PUMP_SWITCH); LightController.ProcessWrites(); } //FUEL AFT L if (id == FSIID.MBI_FUEL_LEFT_AFT_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_LEFT_AFT_PUMP_SWITCH) { debug("FUEL AFT LEFT PUMP On"); } else { debug("FUEL AFT LEFT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_LEFT_AFT_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_LEFT_AFT_PUMP_SWITCH); LightController.ProcessWrites(); } //FUEL AFT R if (id == FSIID.MBI_FUEL_RIGHT_AFT_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_RIGHT_AFT_PUMP_SWITCH) { debug("FUEL AFT RIGHT PUMP On"); } else { debug("FUEL AFT RIGHT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_RIGHT_AFT_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_RIGHT_AFT_PUMP_SWITCH); LightController.ProcessWrites(); } //FUEL FWD L if (id == FSIID.MBI_FUEL_LEFT_FWD_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_LEFT_FWD_PUMP_SWITCH) { debug("FUEL FWD LEFT PUMP On"); } else { debug("FUEL FWD LEFT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_LEFT_FWD_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_LEFT_FWD_PUMP_SWITCH); LightController.ProcessWrites(); } //FUEL FWD R if (id == FSIID.MBI_FUEL_RIGHT_FWD_PUMP_SWITCH) { if (FSIcm.inst.MBI_FUEL_RIGHT_FWD_PUMP_SWITCH) { debug("FUEL FWD RIGHT PUMP On"); } else { debug("FUEL FWD RIGHT PUMP Off"); } //ELT light LightController.set(FSIID.MBI_FUEL_RIGHT_FWD_PUMP_LOW_PRESSURE_LIGHT, !FSIcm.inst.MBI_FUEL_RIGHT_FWD_PUMP_SWITCH); LightController.ProcessWrites(); } }
// Start is called before the first frame update public override void OnStart() { lightcontroller = lightControllerObject.GetComponent <LightController>(); audioPlayer = GameObject.FindObjectOfType <AudioPlayer>(); }
void Start() { lightController = GameObject.Find("BackgroundVideoManager").GetComponent <LightController> (); screenController = GameObject.Find("ScreenVideoManager").GetComponent <ScreenController> (); lightSwitch = GameObject.Find("Lever").GetComponent <LightSwitch> (); }
private void TraverseScene(Transform root, string parentPath) { foreach (Transform currentTransform in root) { if (currentTransform == SceneManager.BoundingBox) { continue; } string path = parentPath; path += "/" + currentTransform.name; // Depending on its type (which controller we can find on it) create data objects to be serialized LightController lightController = currentTransform.GetComponent <LightController>(); if (null != lightController) { LightData lightData = new LightData(); SetCommonData(currentTransform, parentPath, path, lightController, lightData); SetLightData(lightController, lightData); SceneData.Current.lights.Add(lightData); continue; } CameraController cameraController = currentTransform.GetComponent <CameraController>(); if (null != cameraController) { CameraData cameraData = new CameraData(); SetCommonData(currentTransform, parentPath, path, cameraController, cameraData); SetCameraData(cameraController, cameraData); SceneData.Current.cameras.Add(cameraData); continue; } ColimatorController colimatorController = currentTransform.GetComponent <ColimatorController>(); if (null != colimatorController) { // Nothing to do here, ignore the object continue; } // Do this one at the end, because other controllers inherits from ParametersController ParametersController controller = currentTransform.GetComponent <ParametersController>(); ObjectData data = new ObjectData(); SetCommonData(currentTransform, parentPath, path, controller, data); try { SetObjectData(currentTransform, controller, data); SceneData.Current.objects.Add(data); } catch (Exception e) { Debug.Log("Failed to set object data: " + e.Message); } // Serialize children if (!data.isImported) { TraverseScene(currentTransform, path); } } }
private void Awake() { _audioSource = GetComponent <AudioSource>(); _lightControl = GetComponent <LightController>(); }
void Start() { lightController = GameObject.FindGameObjectWithTag ("LightController").GetComponent<LightController>(); }