Task doTheThing() { List <Task> getStuffDoneList = new List <Task>(); Task CheckIfDoorLocked = new isDoorLocked(bigDoor); Task openTheDoorKronk = new DoorOpen(bigDoor); getStuffDoneList.Add(CheckIfDoorLocked); getStuffDoneList.Add(openTheDoorKronk); Sequencer cmonInDoorsUnlocked = new Sequencer(getStuffDoneList); List <Task> goGetIt = new List <Task>(); Task moveForward = new moveTowardTarget(this.gameObject, bigDoor.gameObject); Task getTreasure = new moveTowardTarget(this.gameObject, Treasure.gameObject); goGetIt.Add(moveForward); goGetIt.Add(getTreasure); Sequencer moveAlready = new Sequencer(goGetIt); List <Task> goGetTheTreasureIndy = new List <Task>(); goGetTheTreasureIndy.Add(cmonInDoorsUnlocked); goGetTheTreasureIndy.Add(moveAlready); Selector doItNow = new Selector(goGetTheTreasureIndy); return(doItNow); }
protected override void OnMouseUp() { playerPosition = GameObject.Find("Player").transform; // Academy if (sceneName == "Academy") { if (Mathf.Abs(transform.position.x - targetBlock[0].position.x) <= 0.5f && Mathf.Abs(transform.position.y - targetBlock[0].position.y) <= 0.5f) { transform.position = new Vector2(targetBlock[0].position.x, targetBlock[0].position.y); SceneManager.LoadScene("Outside Academy"); } else if (Mathf.Abs(transform.position.x - targetBlock[1].position.x) <= 0.5f && Mathf.Abs(transform.position.y - targetBlock[1].position.y) <= 0.5f) { transform.position = new Vector2(targetBlock[1].position.x, targetBlock[1].position.y); DoorOpen.OpenDoor(); transform.position = new Vector2(playerPosition.position.x + initialPosition.x, playerPosition.position.y + initialPosition.y); } else { for (int i = 0; i < targetBlocks.Length; i++) { if (Mathf.Abs(transform.position.x - targetBlocks[i].transform.position.x) <= 0.5f && Mathf.Abs(transform.position.y - targetBlocks[i].transform.position.y) <= 0.5f) { Progress.emotion++; } } transform.position = new Vector2(playerPosition.position.x + 4.382f, playerPosition.position.y + 3.119f); } } // Outside Academy if (sceneName == "Outside Academy") { if (Mathf.Abs(transform.position.x - targetBlockSingle.position.x) <= 0.5f && Mathf.Abs(transform.position.y - targetBlockSingle.position.y) <= 0.5f) { transform.position = new Vector2(targetBlockSingle.position.x, targetBlockSingle.position.y); SceneManager.LoadScene("Academy"); Progress.previousScene = "Outside Academy"; Progress.exp++; } else { for (int i = 0; i < targetBlocks.Length; i++) { if (Mathf.Abs(transform.position.x - targetBlocks[i].transform.position.x) <= 0.5f && Mathf.Abs(transform.position.y - targetBlocks[i].transform.position.y) <= 0.5f) { Progress.emotion++; } } transform.position = new Vector2(playerPosition.position.x + 4.382f, playerPosition.position.y + 3.119f); } } }
// Update is called once per frame void Update() { if (InputManager.GetKeyDown(InputNames.use)) { Ray ray = new Ray(firePos.position, firePos.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, interactRange, 1 << LayerMask.NameToLayer("Pickable"))) { if (hit.transform.CompareTag("Door")) { DoorOpen doorOpen = hit.transform.GetComponent <DoorOpen>(); if (doorOpen != null) { doorOpen.TryOpenDoor(); } } else if (!hit.transform.CompareTag("Key")) { if (playerInventory.PickupItem(hit.transform)) { Destroy(hit.transform.gameObject); } } else { gameManager.AddKey(hit.transform.GetComponent <KeyPickable>().keyName); Destroy(hit.transform.gameObject); } } } }
void setupDoorScripts(GameObject door, RoomObject room) { DoorOpen doorOpenScript = door.AddComponent <DoorOpen> (); doorOpenScript.setDoorSide(room.onRightSideOfHall); door.tag = DOOR_TAG; }
public void buildBehaviorTree() { Task[] tasks = new Task[2]; tasks[0] = new DoorUnlocked(door); tasks[1] = new OpenDoor(door); Task sequence = new Sequence(tasks); tasks = new Task[2]; tasks[0] = new DoorClosed(door); tasks[1] = new BargeDoor(door); Task sequence2 = new Sequence(tasks); tasks = new Task[2]; tasks[0] = sequence; tasks[1] = sequence2; Task selector = new Selector(tasks); tasks = new Task[2]; tasks[0] = new DoorOpen(door); tasks[1] = new MoveRoom(this.transform); sequence = new Sequence(tasks); tasks = new Task[3]; tasks[0] = new MoveDoor(this.transform); tasks[1] = selector; tasks[2] = new MoveRoom(this.transform); sequence2 = new Sequence(tasks); tasks = new Task[2]; tasks[0] = sequence; tasks[1] = sequence2; task = new Selector(tasks); }
public void Handle(DoorOpen message) { //Validate // //Process // } // }
void Start() { doorToClose = !IsNullOrEmpty(doorToCloseTag) ? GameObject.FindWithTag(doorToCloseTag) : null; GameObject doorToOpenGameObject = !IsNullOrEmpty(doorToOpenTag) ? GameObject.FindWithTag(doorToOpenTag) : null; if (doorToOpenGameObject != null) { doorToOpen = doorToOpenGameObject.GetComponent <DoorOpen>(); } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
public IEnumerator TriggerPuzzleSolvedSequence() { if (ThunderLights == null) { foreach (FlickerLights item in FindObjectsOfType <FlickerLights>()) { if (item.name.Contains("Thunder")) { ThunderLights = item; } } } if (RoomLights != null) { RoomLights.StayOnWhenNotFlickering = false; RoomLights.StartFlickering(); } if (ThunderLights != null) { ThunderLights.StartFlickering(); } if (audioOnPuzzleSolved != null) { audioOnPuzzleSolved.Play(); } yield return(new WaitForSeconds(timeToWaitBeforeOpeeningDoor)); GameObject doorObject = GameObject.FindGameObjectWithTag(doorToOpenTag); Debug.Log("DoorObject: " + doorObject); if (doorObject != null) { DoorOpen doorOpenScript = doorObject.GetComponent <DoorOpen>(); Debug.Log("DoorOpenScript: " + doorOpenScript); if (doorOpenScript != null) { doorOpenScript.soundPlayed = false; doorOpenScript.rotationDegreesAmount = 180.0f; doorOpenScript.openDoor = true; doorOpenScript.doorOpened = false; } GameObject kitchenDoor = GameObject.FindGameObjectWithTag("SKitchenDoor"); if (kitchenDoor != null) { kitchenDoor.SetActive(false); } } }
public void OnTriggerEnter2D(Collider2D collider) { if (collider.GetComponent <Player>()) { if (!_isOpen) { _isOpen = true; _animator.SetTrigger("isOpen"); DoorOpen?.Invoke(true); } } }
public void OnTriggerExit2D(Collider2D collider) { if (collider.GetComponent <Player>()) { Vector2 contactPoint = collider.ClosestPoint(new Vector2(0, 0)); if (contactPoint.x < _directionOutward) { DoorOpen?.Invoke(false); _isOpen = false; _animator.ResetTrigger("isOpen"); } } }
// Use this for initialization void Start() { rbody = GameObject.FindGameObjectWithTag("BirdObj").GetComponent <Rigidbody2D>(); birdpos = GameObject.FindGameObjectWithTag("BirdObj").GetComponent <Transform>().position; bird = GameObject.FindGameObjectWithTag("BirdObj").GetComponent <Transform>().position; panel = GameObject.FindGameObjectWithTag("belowMsg").GetComponent <CanvasRenderer>(); ptext = GameObject.FindGameObjectWithTag("panelTxt").GetComponent <Text>(); img = GameObject.FindGameObjectWithTag("belowMsg").GetComponent <Image>(); canvTog = GameObject.FindGameObjectWithTag("belowMsg").GetComponent <CanvasToggle>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>(); warper = GameObject.FindGameObjectWithTag("door").GetComponent <Warp>(); doorOpen = GameObject.FindGameObjectWithTag("dooropen").GetComponent <DoorOpen>(); }
// Use this for initialization void Start() { door = GetComponentInChildren<DoorOpen> (); int rand_value = Random.Range(0, 2); if (rand_value == 0) { int broken = Random.Range (0, 4); if (broken == 0) { door.isBroken = true; door.SetPosition(1.25f); } } else { gameObject.SetActive (false); } }
public override void StartUsing(VRTK_InteractUse currentUsingObject = null) { base.StartUsing(currentUsingObject); SwitchOn(); if (isUsingForFirstTime) { GameObject livingRoomDoor = GameObject.FindGameObjectWithTag("LivingRoomDoor"); DoorOpen dooropen1 = livingRoomDoor.GetComponent <DoorOpen>(); dooropen1.openDoor = true; isUsingForFirstTime = false; } }
void Update() { if (button1 == true && button3 == true && button6 == true && button8 == true) { print("Door Should Open"); DoorOpen.Open(); //Disable buttons - anims and sounds // Change lighting? //Buttons perhaps flicker a light // Or/and the room lighting increases } }
//increase the speed of the blade when water hits it void OnParticleCollision(GameObject particle) { DoorOpen script = GameObject.Find("door1").GetComponent <DoorOpen> (); if (particle.tag == "water") { speed += 1; //open the gate if the speed is great enough if (speed >= 12) { script.doorOpenAndClose(); } } }
// Update is called once per frame void Update() { if (Input.GetButtonDown("Fire1")) { Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, interactDistance)) { if (hit.collider.gameObject.CompareTag("Door")) { DoorOpen door = hit.collider.gameObject.GetComponent <DoorOpen>(); door.ChangeDoorState(); } } } }
/// <inheritdoc/> public string ToDelimitedString() { CultureInfo culture = CultureInfo.CurrentCulture; return(string.Format( culture, StringHelper.StringFormatSequence(0, 38, Configuration.FieldSeparator), Id, CycleStartTime.HasValue ? CycleStartTime.Value.ToString(Consts.TimeFormatPrecisionSecond, culture) : null, CycleCount.HasValue ? CycleCount.Value.ToString(Consts.NumericFormat, culture) : null, TempMax?.ToDelimitedString(), TempMin?.ToDelimitedString(), LoadNumber.HasValue ? LoadNumber.Value.ToString(Consts.NumericFormat, culture) : null, ConditionTime?.ToDelimitedString(), SterilizeTime?.ToDelimitedString(), ExhaustTime?.ToDelimitedString(), TotalCycleTime?.ToDelimitedString(), DeviceStatus?.ToDelimitedString(), CycleStartDateTime.HasValue ? CycleStartDateTime.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null, DryTime?.ToDelimitedString(), LeakRate?.ToDelimitedString(), ControlTemperature?.ToDelimitedString(), SterilizerTemperature?.ToDelimitedString(), CycleCompleteTime.HasValue ? CycleCompleteTime.Value.ToString(Consts.TimeFormatPrecisionSecond, culture) : null, UnderTemperature?.ToDelimitedString(), OverTemperature?.ToDelimitedString(), AbortCycle?.ToDelimitedString(), Alarm?.ToDelimitedString(), LongInChargePhase?.ToDelimitedString(), LongInExhaustPhase?.ToDelimitedString(), LongInFastExhaustPhase?.ToDelimitedString(), Reset?.ToDelimitedString(), OperatorUnload?.ToDelimitedString(), DoorOpen?.ToDelimitedString(), ReadingFailure?.ToDelimitedString(), CycleType?.ToDelimitedString(), ThermalRinseTime?.ToDelimitedString(), WashTime?.ToDelimitedString(), InjectionRate?.ToDelimitedString(), ProcedureCode?.ToDelimitedString(), PatientIdentifierList != null ? string.Join(Configuration.FieldRepeatSeparator, PatientIdentifierList.Select(x => x.ToDelimitedString())) : null, AttendingDoctor?.ToDelimitedString(), DilutionFactor?.ToDelimitedString(), FillTime?.ToDelimitedString(), InletTemperature?.ToDelimitedString() ).TrimEnd(Configuration.FieldSeparator.ToCharArray())); }
public async Task <IActionResult> OpenDoor(int id, [FromBody] DoorOpen body) { try { var room = await _roomsService.DoorOpen(id, body.Direction, body.ToRoomId); return(Ok(room)); } catch (DatabaseException e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } catch (NoSuchRoomException e) { return(StatusCode(StatusCodes.Status400BadRequest, e.Message)); } }
void Update() { if (button1 == true && button2 == true && button3 == true && button4 == true && button5 == true && button6 == true) { DoorOpen.Open(); PointLight1.light.color = Color.blue; //Disable buttons - anims and sounds // Change lighting? //Buttons perhaps flicker a light // Or/and the room lighting increases } if (buzz == true) { GetComponent <AudioSource>().Play(); buzz = false; } }
void OnTriggerEnter(Collider other) { if (StateMachine.Instance.State != GameState.FindBoxAgain01 || Player.instance.inhand != Player.instance.BOX) { return; } DoorOpen d = FrontDoor.GetComponentInChildren <DoorOpen>(); if (d.Open) { d.Trigger(); } d.locked = true; AudioSource.PlayClipAtPoint(Audio, this.FrontDoor.position); foreach (var holzbrett in Holzbretter) { holzbrett.SetActive(true); } StateMachine.Instance.State = GameState.FindeWerkzeuge02; Destroy(gameObject); }
// Use this for initialization void Start() { doorOpen = GameObject.Find("DoorFather").GetComponent <DoorOpen>(); }
IEnumerator StartLevel() { yield return(new WaitForSeconds(1f)); //restartButton.SetActive(false); mainCamera = Camera.main; currentLevel = SceneManager.GetActiveScene().buildIndex; if (SceneManager.GetActiveScene().name != "Level_Soul") { LevelEndImage = GameObject.Find("SceneTransition"); LevelEndImage.SetActive(true); GameSettings.GetSettings(); if (SceneManager.GetActiveScene().name == "Tutorial") { maxHealth = GameSettings.playerMaxHealth; currentPlayerHealth = maxHealth; NumberOfJumps = 1; } else { RespawnPoint = GameObject.FindGameObjectWithTag("RespawnPoint").transform; RespawnPoint.position = PlayerStats.currentRespawnPoint; if (RespawnPoint.position == Vector3.zero) { RespawnPoint.position = GameObject.Find("PlayerFirstSpawnPoint").transform.position; } Instantiate(playerPrefab, RespawnPoint.position, Quaternion.identity); NumberOfJumps = 2; if (SceneManager.GetActiveScene().name != "EndScene") { currentPlayerHealth = PlayerStats.playerHealth; maxHealth = PlayerStats.playerMaxHealth; diamondsCollected = PlayerStats.playerDiamondsCollected; enemiesKilled = PlayerStats.enemiesKilled; diamondCount = GameObject.Find("DiamondCount").GetComponent <TMP_Text>(); diamondCount.text = diamondsCollected.ToString(); } } cameraController = mainCamera.GetComponentInParent <CameraController_Hero>(); playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController_Hero>(); attackController = GameObject.FindGameObjectWithTag("PlayerSpriteObject").GetComponent <PlayerAttackController>(); if (SceneManager.GetActiveScene().name != "Tutorial" && SceneManager.GetActiveScene().name != "EndScene") { GetPlayerStats(); } playerController.SetupPlayer(); attackController.SetupPlayer(); cameraController.SetupCamera(); if (SceneManager.GetActiveScene().name != "EndScene") { HeartsHealthVisual.instance.SetHealthBar(maxHealth / 4); HeartsHealthVisual.healthSystem.Damage((int)(maxHealth - currentPlayerHealth)); attackController.SetupHealth(currentPlayerHealth); enemySpawner = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent <EnemySpawner>(); enemySpawner.enemiesCloned = GameSettings.enemies; enemySpawner.usedSpawnPoints = GameSettings.usedPoints; enemySpawner.SetupEnemies(); } if (GameObject.FindGameObjectWithTag("ExitDoor") != null) { exitDoor = GameObject.FindGameObjectWithTag("ExitDoor").GetComponent <DoorOpen>(); } if (SceneManager.GetActiveScene().name != "Tutorial") { enableDash(); enableDoubleJump(); enableJump(); enemiesInLevel = GameSettings.EnemyCount; } else if (SceneManager.GetActiveScene().name == "Tutorial") { enemiesInLevel = 1; skipTutorialButton = GameObject.Find("SkipTut").GetComponent <Button>(); skipTutorialButton.interactable = true; } isLevelActive = true; } }
// Use this for initialization void Start() { door = GameObject.FindGameObjectWithTag("Door").GetComponent <DoorOpen>(); }
void FixedUpdate() { if (HP < 0) { deadCamera.gameObject.SetActive(true); deadCamera.gameObject.transform.position = this.transform.position; this.gameObject.SetActive(false); } RaycastHit hit; Ray ray = playerCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { GameObject objectHit = hit.collider.gameObject; float dist = Vector3.Distance(objectHit.transform.position, this.transform.position); if (objectHit.CompareTag("door")) { if (dist < 5) { if (objectHit.gameObject.GetComponent("DoorOpen") != null) { at = objectHit.gameObject.GetComponent <DoorOpen> (); _consoleLD41.mainConsole.tipsDoor.gameObject.SetActive(true); isOkayToOpenDoor = true; } } else { _consoleLD41.mainConsole.tipsDoor.gameObject.SetActive(false); isOkayToOpenDoor = false; } } else { _consoleLD41.mainConsole.tipsDoor.gameObject.SetActive(false); isOkayToOpenDoor = false; } if (objectHit.CompareTag("food")) { if (dist < 2) { if (objectHit.gameObject.GetComponent("FoodObject") != null) { fo = objectHit.gameObject.GetComponent <FoodObject> (); isOkayToTakeItem = true; _consoleLD41.mainConsole.tipsFood.gameObject.SetActive(true); } } else { isOkayToTakeItem = false; _consoleLD41.mainConsole.tipsFood.gameObject.SetActive(false); } } else { isOkayToTakeItem = false; _consoleLD41.mainConsole.tipsFood.gameObject.SetActive(false); } if (objectHit.CompareTag("cook")) { if (dist < 4) { _consoleLD41.mainConsole.tipsCooking.gameObject.SetActive(true); isOkayToCook = true; } else { _consoleLD41.mainConsole.tipsCooking.gameObject.SetActive(false); isOkayToCook = false; } } else { _consoleLD41.mainConsole.tipsCooking.gameObject.SetActive(false); isOkayToCook = false; } if (objectHit.CompareTag("craftingTable")) { if (dist < 4) { _consoleLD41.mainConsole.tipsCrafting.gameObject.SetActive(true); isOkayToCraft = true; } else { _consoleLD41.mainConsole.tipsCrafting.gameObject.SetActive(false); isOkayToCraft = false; } } else { _consoleLD41.mainConsole.tipsCrafting.gameObject.SetActive(false); isOkayToCraft = false; } if (objectHit.CompareTag("wash")) { if (dist < 4) { _consoleLD41.mainConsole.tipsWashing.gameObject.SetActive(true); isOkayToGetWaterFromSinkWash = true; } else { _consoleLD41.mainConsole.tipsWashing.gameObject.SetActive(false); isOkayToGetWaterFromSinkWash = false; } } else { _consoleLD41.mainConsole.tipsWashing.gameObject.SetActive(false); isOkayToGetWaterFromSinkWash = false; } } if (isOkayToOpenDoor) { if (Input.GetKeyUp(KeyCode.E)) { if (at.isOpen) { at.CloseDoor(); } else { at.OpenDoor(); } } } if (isOkayToTakeItem) { if (Input.GetButtonUp("Fire1")) { if (_consoleLD41.mainConsole.FindingAllPossibleEmptySlot() != null) { BackpackSlot BS = _consoleLD41.mainConsole.FindingAllPossibleEmptySlot(); _consoleLD41.mainConsole.RegisterItem(BS, fo.itemID, fo.gameObject); fo.gameObject.transform.position = placeholderPhysicalObject.transform.position; fo.gameObject.transform.parent = placeholderPhysicalObject.transform; fo.gameObject.SetActive(false); fo = null; } } } if (isOkayToCook) { if (Input.GetKeyUp(KeyCode.E)) { _consoleLD41.mainConsole.CookingMode(); } } if (isOkayToCraft) { if (Input.GetKeyUp(KeyCode.E)) { _consoleLD41.mainConsole.CraftingResult(); } } if (isOkayToGetWaterFromSinkWash) { if (Input.GetKeyUp(KeyCode.E)) { _consoleLD41.mainConsole.FillWaterInsideContainer(); } } if (currentWeaponID != 0) { if (Input.GetButtonUp("Fire1")) { if (currentWeaponID != 1) { Instantiate(whatProjectiles [currentWeaponID], projectileOut.position, projectileOut.rotation); _consoleLD41.mainConsole.EverySinglePeoplePanic(); } else if (currentWeaponID == 1 && !isOkayToTakeItem) { //BANANAS SECTION int ifThereisBananas = 0; for (int x = 0; x < _consoleLD41.mainConsole.backpackSlots.Count; x++) { if (_consoleLD41.mainConsole.backpackSlots [x].itemID == 2) { ifThereisBananas++; } } if (ifThereisBananas > 0) { Instantiate(whatProjectiles [currentWeaponID], projectileOut.position, projectileOut.rotation); _consoleLD41.mainConsole.EverySinglePeoplePanic(); RequireCertainAmmunition(2); } //END SECTION } if (currentWeaponID == 2) { RemoveWeapon(); } if (currentWeaponID == 3) { RemoveWeapon(); } if (currentWeaponID == 4) { RemoveWeapon(); } } } }
//private ShakeCamera camShake; // Use this for initialization void Start() { audio = this.GetComponent <AudioSource>(); doorScrpit = GameObject.Find("Door").GetComponent <DoorOpen>(); //camShake = GameObject.Find("CameraFixed").GetComponent<ShakeCamera>(); }
// Use this for initialization void Start() { stats = GetComponent<UnitStats>(); coll = GetComponent<Collider>(); door = GetComponent<DoorOpen>(); waypointCache = GetComponentsInChildren<BarricadeWaypoint>(); unitCache = null; baseSelfHealCache = selfHealAmount; }