public void Interact() { if (_isOnDialogueTrigger) { if (!_hasDialogueStarted && !_hasDialogueBeenSaid) { _playerMovement.LockMovement(true); _playerUI.DialogueUI.StartDialogue(); DialogueManager.Instance.StartDialogue(_dialogue, 1); _hasDialogueStarted = true; _hasDialogueBeenSaid = true; } else { DialogueManager.Instance.NextSentence(); if (DialogueManager.Instance.HasDialogueEnded()) { _playerMovement.LockMovement(false); } } } if (_trapDoor != null) { _playerCinematic.EnterDoor(); _trapDoor.OpenDoor(); _trapDoor = null; } if (_lever != null) { _lever.OpenGate(); _lever = null; } _playerUI.InteractUI.SetPrompt(false); }
//bouwt heel het level op vanuit het template public void BuildLevel() { //verwijder alle oude kinderen for (int i = 0; i < worldRoot.transform.childCount; i++) { GameObject.Destroy(worldRoot.transform.GetChild(i).gameObject); } //maakt voor elk element in de grid van de template een nieuwe block met bijpassende kleur. deze blokken zullen zelf zich in de scene zetten in de constructor grid = new Block[template.Width, template.Height]; for (int y = 0; y < template.Height; y++) { for (int x = 0; x < template.Width; x++) { grid[x, y] = new Block(x, y, template.Blocks[x, y], worldRoot); } } //new entities entities = new List <Entity>(); foreach (EntityTemplate entityT in template.Entities) // voor elke entity die in de template staat gaat hij een nieuwe entity maken. { Entity newEntity; switch (entityT.Type) //afhankelijk van het type entity gaat deze een andere constructor aanspreken { case EntityType.Player: newEntity = new Player(entityT.X, entityT.Y, worldRoot); break; case EntityType.Exit: newEntity = new Exit(entityT.X, entityT.Y, worldRoot); break; case EntityType.Teleporter: newEntity = new Teleporter(entityT.X, entityT.Y, worldRoot, new Coordinates((int)entityT.ExtraData[0], (int)entityT.ExtraData[1])); // voor een tele word de extra data gebruikt, 1e element is int xcoordinaat, 2e element is int ycoordinaat break; case EntityType.Lever: newEntity = new Lever(entityT.X, entityT.Y, worldRoot); break; default: Debug.Log("Fout: EntityType is onbekend."); newEntity = null; break; } if (newEntity != null) // normaal gezien lukt dit maar toch om zeker te zijn { entities.Add(newEntity); } else { Debug.Log("FOUT: entity is niet geinitializeerd."); } } }
public static void Reflection() { Node node = new Node(4, 5, 0, new Properties()); Lever leverOfNode = new Lever(node.GetProperties()); leverOfNode["DIFFICULTY"] = 124; }
private void Tool_Lever(Vector2 mouse, int type_index) { if (tools.index == 2 && tools.interactive_tool.index == 0) { if (Input.GetKeyDown(KeyCode.Q)) { if (mouse.x >= 0 && mouse.y >= 0) { RaycastHit2D hit = Physics2D.Raycast(new Vector2(GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition).x, GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f); if (hit.transform == null) { Lever lever = ((GameObject)Instantiate(Resources.Load(ResourceDirectory.resource[System.Type.GetType("Lever")].path, typeof(GameObject)), new Vector3(mouse.x, mouse.y, -9), transform.rotation)).GetComponent <Lever>(); GameManager.current_game.progression.maps[GameManager.current_game.progression.loaded_map].entities[type_index].Add(lever); } } } if (Input.GetKey(KeyCode.W)) { RaycastHit2D hit = Physics2D.Raycast(new Vector2(GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition).x, GetComponent <Camera>().ScreenToWorldPoint(Input.mousePosition).y), Vector2.zero, 0f); if (hit.transform != null && hit.transform.gameObject.GetComponent <Lever>() != null) { ArrayList interactives = GameManager.current_game.progression.maps[GameManager.current_game.progression.loaded_map].entities[type_index]; Lever lever = (Lever)interactives[interactives.IndexOf(hit.transform.gameObject.GetComponent <Lever>())]; GameManager.current_game.progression.maps[GameManager.current_game.progression.loaded_map].entities[type_index].Remove(lever); Destroy(lever.gameObject); } } } }
public void OnTurnLeverStart(Lever lever) { playerController.velocity = Vector3.zero; leverInUse = lever; leverInUse.IsUsable = false; //CanUseLever = false; // Align position with lever transform.position = new Vector3(lever.transform.position.x, transform.position.y, transform.position.z); // Disable player controller so player cannot move playerController.isControllable = false; flipBeforeLever = puppet2DGlobalControl.flip; // Animation if (lever.currentLeverState == Lever.LeverState.Left) { puppet2DGlobalControl.flip = true; animator.SetTrigger(turnLeverTriggerHash); } else { puppet2DGlobalControl.flip = false; animator.SetTrigger(turnLeverTriggerHash); } }
public BaseLeverInteraction(SpawnCommand p_command, Int32 p_parentID, Int32 p_commandIndex) : base(p_command, p_parentID, p_commandIndex) { m_parent = Grid.FindInteractiveObject(m_parentID); InteractiveObject interactiveObject = Grid.FindInteractiveObject(m_targetSpawnID); m_targetLever = (interactiveObject as Lever); }
void Start() { player = FindObjectOfType <Player>(); foreach (GameObject sObject in FindGameObjectsWithTags(new string[] { "orangeDestroy", "coin" })) { stateObjects.Add(sObject); } foreach (GameObject dObject in GameObject.FindGameObjectsWithTag("dissPlatform")) { FallingPlatform fPlatform = dObject.GetComponent <FallingPlatform>(); fallingPlatforms.Add(fPlatform); } foreach (GameObject pObject in FindGameObjectsWithTags(new string[] { "movingPlatform", "chaseBoss" })) { PlatformController pController = pObject.GetComponent <PlatformController>(); platforms.Add(pController); } foreach (GameObject lObject in GameObject.FindGameObjectsWithTag("Lever")) { Lever lever = lObject.GetComponent <Lever>(); levers.Add(lever); } }
void Awake() { thisLoggingID = loggingID++; GetComponent <KMBombModule>().OnActivate += Init; Dials = new KMSelectable[] { Dial1, Dial2, Dial3, Dial4, Dial5, Dial6 }; for (int a = 0; a < 6; a++) { Dials[a].transform.Find("LED").GetComponent <MeshRenderer>().material.color = new Color(0, 0, 0); Dials[a].transform.Find("default").GetComponent <MeshRenderer>().material.color = new Color(0.91f, 0.88f, 0.86f); } for (int a = 0; a < 6; a++) { Dials[a].transform.Find("Bar").GetComponent <MeshRenderer>().material.color = new Color(0.4f, 0.4f, 0.4f); DialPos[a] = Random.Range(0, 12); Dials[a].transform.Find("Bar").transform.localEulerAngles = new Vector3(0, DialPos[a] * 30f, 0); ClickPos[a] = Random.Range(0, 12); int a2 = a; Dials[a].OnInteract += delegate() { HandleInteract(a2); return(false); }; } Debug.Log("[Safety Safe #" + thisLoggingID + "] Safety Safe dial click locations: " + ClickPos[0] + "," + ClickPos[1] + "," + ClickPos[2] + "," + ClickPos[3] + "," + ClickPos[4] + "," + ClickPos[5]); Lever.GetComponent <MeshRenderer>().material.color = new Color(0.91f, 0.88f, 0.86f); Lever.transform.Find("default").GetComponent <MeshRenderer>().material.color = new Color(0.91f, 0.88f, 0.86f); }
// Use to process your families. protected override void onProcess(int familiesUpdateCount) { if (Input.GetMouseButtonDown(0)) { // Only one GO is under pointer GameObject leverFocused_GO = levers.First(); if (leverFocused_GO != null) { Lever lever = leverFocused_GO.GetComponent <Lever> (); // Check if the hero is near to the boiler (only hero can produce this component thanks to Unity Physics layers) Triggered3D triggered = leverFocused_GO.GetComponent <Triggered3D> (); if (triggered != null) { lever.isOn = !lever.isOn; SpriteRenderer sr = leverFocused_GO.GetComponent <SpriteRenderer> (); if (lever.isOn) { sr.sprite = lever.on; MonitoringManager.trace(fm, "turnOn", MonitoringManager.Source.PLAYER); } else { sr.sprite = lever.off; MonitoringManager.trace(fm, "turnOff", MonitoringManager.Source.PLAYER); } } } } }
public void Should_Pass_When_All_State_Are_Equal_To_Result(bool state, bool result) { var lever = new Lever(state); lever.Switch().Should().Be(result); lever.State.Should().Be(result); }
public void ColisionHandling(RaycastHit2D hit, Vector3 end) { if (hit.transform.tag == "Lever") { Lever lever = hit.transform.GetComponent <Lever>(); lever.state = !lever.state; } if (hit.transform.tag == "Dialogue Trigger") { DialogueTrigger dialogueTrigger = hit.transform.GetComponent <DialogueTrigger>(); dialogueTrigger.TriggerDialogue(); } if (hit.transform.tag == "Key") { Key pickedUpKey = hit.transform.GetComponent <Key>(); pickedUpKey.OnPickUp(); keyChain.Add(pickedUpKey); rb2D.MovePosition(end); } if (hit.transform.tag == "LockedDoor") { InvisibleDoor_Key door_Key = hit.transform.GetComponent <InvisibleDoor_Key>(); door_Key.tryToOpen(keyChain); } }
void Start() { switch (myInteraction) { case Interaction.Lever: l = GetComponent <Lever>(); break; case Interaction.Candle: c = GetComponent <Candle>(); break; case Interaction.Door: t = GetComponent <TransitionDoor>(); break; case Interaction.Dialogue: f = GetComponent <Flowchart>(); break; case Interaction.Weight: w = GetComponent <WeightButton>(); break; } }
// Start is called before the first frame update protected virtual void Awake() { if (boxSpawner != null) { boxSpawner.frequency = 0f; CycleElapsed += boxSpawner.Spawn; Reset += boxSpawner.DestroyAll; } if (boxReceptacle != null) { boxReceptacle.boxReceived += BoxReceived; } if (endDoor != null) { endDoor.Opened += ResetAll; Reset += endDoor.ResetCount; } Lever lever = GetComponentInChildren <Lever>(); if (lever != null) { lever.Pulled += ResetAll; } framesPerCopy = (int)(secondsPerCopy / Time.fixedDeltaTime); CalculateSpawnParticlesOffset(); }
protected override void ChangeLeverState(GameObject lever) { if (lever.name.StartsWith("Lever")) { Lever leverScript = lever.GetComponent <Lever>(); lever.GetComponent <AudioSource>().Play(); if (leverScript.active) { leverScript.DisactiveLever(); } else { leverScript.ActivateLever(); } } else { // It is a fake FakeLever leverScript = lever.GetComponent <FakeLever>(); if (leverScript.active) { leverScript.DisactiveLever(); } else { leverScript.ActivateLever(); } } }
void Start() { lever = this; anim[0] = GetComponent <Animator>(); anim[1].SetBool("open_close", false); anim[2].SetBool("open_close", false); }
// Use this for initialization void Start() { _isShowingResults = false; _lever = GetComponentInChildren <Lever>(); _hopper = GetComponentInChildren <Hopper>(); _screen = GetComponentInChildren <BanditScreen>(); }
public void InteractLever(Lever lever) { _currentLever = lever; if (_currentLever) { SetDestination(_currentLever.playerPos.position); } }
public Quest_MomAndBaby_02(BirdBaby _baby, BirdMom _mom) { mom = _mom; baby = _baby; lever = mom.lever; isClear = false; }
private void Start() { _startPosition = transform.position; _endPosition = transform.position + (Vector3.down * _offset); _leverComponent01 = Lever01.GetComponent <Lever>(); _leverComponent02 = Lever02.GetComponent <Lever>(); }
void Start() { lever = hinge.GetComponent <Lever>(); lever.LeverPercentage = 0; audio = GetComponent <AudioSource>(); jointHelper = GetComponent <JointHelper>(); wrenchEnabled = true; }
void Start() { anim = GetComponent <Animator>(); nextLevel.SetActive (false); if (leverObj == null) leverObj = GameObject.FindWithTag ("Lever"); lever = leverObj.GetComponent<Lever>(); }
private void Start() { m_lever = GameObject.Find("Lever").GetComponent <Lever>(); m_stand = GameObject.Find("Stand").GetComponent <Stand>(); m_cargoPanel = GameObject.Find("CargoPanel").GetComponent <CargoPanel>(); m_level = 1; }
public void EnteringDriveModeResultsInEvent() { var lever = new Lever(); var events = lever.EnterDriveMode(); Assert.True(events.Any(x => x is DriveModeEntered)); }
private void Remove(Lever lever) { if (!this.levers.Contains(lever)) { throw new ArgumentException("Lever not found"); } this.levers.Remove(lever); }
void playerCollidingManagement() { if (!PlayStatusTracker.inPlay) { return; } if (((oneTimeInteraction && !interacted) || !oneTimeInteraction)) { //mostra la E setIndicationVisible(playerColliding); //indication.SetActive(playerColliding); //Debug.Log (gameObject.name +" "+ (inputKeeper!= null && inputKeeper.isButtonUp("Interaction") && ((oneTimeInteraction && !interacted) || !oneTimeInteraction) && playerColliding)); //Debug.Log (gameObject.name +" "+ (((oneTimeInteraction && !interacted) || !oneTimeInteraction) && playerColliding)); //scorre l'array di gameObject e chiama il metodo if (((oneTimeInteraction && !interacted) || !oneTimeInteraction) && playerColliding) { if (inputKeeper != null && inputKeeper.isButtonDown("Interaction")) { //Debug.Log ("inviato messaggio di interazione ad oggetto "); if (audioHandler != null) { //Debug.Log ("i'm in"); audioHandler.playClipByName("Leva"); } interacted = true; for (int i = 0; i < objectsWithMethods.Length; i++) { if (objectsWithMethods[i] != null) { if (activeDisabledObject) { objectsWithMethods[i].SetActive(true); } objectsWithMethods[i].SendMessage(methodToCall, SendMessageOptions.DontRequireReceiver); //Debug.Log ("inviato messaggio di interazione ad oggetto "+objectsWithMethods[i].name); } } //gestione leva Lever leverScript = GetComponent <Lever>(); if (leverScript != null) { leverScript.InteractingMethod(); } //indication.SetActive(false); setIndicationVisible(false); } } } }
static void Main(string[] args) { ILever a = new Lever(true); ILever b = new Lever(true); IGate gate = new NandGate(a, b); Console.WriteLine(gate.State); }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "lever") { lever = other.GetComponent<Lever>(); Destroy (lever); canPull = true; } }
public void Add(Lever lever) { if (this.levers.Contains(lever)) { throw new ArgumentException("The lever is already contained in the list."); } this.levers.Add(lever); this.length = this.length + 1; }
// Use this for initialization void Start() { meantToBeClosed = true; currentlyClosed = true; currentState = (GameObject)Instantiate(closedDoor); initialSprite = GetComponent <SpriteRenderer>(); initialSprite.sprite = null; lever = gameObject.GetComponentInChildren <Lever>(); position = this.gameObject.transform.position; }
void Start() { grabbable = hinge.GetComponent <Grabbable>(); wrenchCollider = GetComponent <Collider>(); lever = hinge.GetComponent <Lever>(); wrenchRigidbody = GetComponent <Rigidbody>(); hingeRigidbody = hinge.GetComponent <Rigidbody>(); jointHelper = hinge.GetComponent <JointHelper>(); audio = GetComponent <AudioSource>(); }
public void Update(GameTime gameTime, Lever lever) { if (lever.isRight) { currentFrame = 1; } else { currentFrame = 0; } }
void LoadLever(string line) { string[] param = line.Split(';'); Lever lever = Instantiate(lever_prefab).GetComponent <Lever>(); for (int i = 1; i < param.Length; i++) { switch (i) { case 1: lever.transform.position = new Vector3(anchor.position.x + float.Parse(param[i]), anchor.position.y + float.Parse(param[i + 1])); i++; continue; case 3: switch (param[i]) { case "t": lever.on = true; lever.GetComponent <SpriteRenderer>().sprite = lever.on_sprite; break; case "f": lever.on = false; lever.GetComponent <SpriteRenderer>().sprite = lever.off_sprite; break; default: break; } continue; case 4: switch (param[i]) { case "v": break; case "h": lever.transform.rotation = Quaternion.Euler(new Vector3(0, 0, 90)); break; default: break; } continue; default: continue; } } lever.controller = this; lever_list.Add(lever); }
void Start() { _fsm = new StateMachine<SlotMachineAI>(this); _fsm.setState(new InsertCoinState()); wheelsArray[0] = GameObject.Find("Wheel0").GetComponent<Wheel>(); wheelsArray[1] = GameObject.Find("Wheel1").GetComponent<Wheel>(); wheelsArray[2] = GameObject.Find("Wheel2").GetComponent<Wheel>(); buttonsArray[0] = GameObject.Find("Button0").GetComponent<Button>(); buttonsArray[1] = GameObject.Find("Button1").GetComponent<Button>(); buttonsArray[2] = GameObject.Find("Button2").GetComponent<Button>(); lever = GameObject.Find("Lever").GetComponent<Lever>(); mouth = GameObject.Find("CatMouth").GetComponent<CatMouth>(); cookieDispenser = GameObject.Find("CookieDispenser").GetComponent<Dispenser>(); particles = GameObject.Find("Particles").GetComponent<ParticleSystem>(); }
void Awake() { Instance = this; }
public static Block GetBlockById(byte blockId) { Block block = null; if (CustomBlockFactory != null) { block = CustomBlockFactory.GetBlockById(blockId); } if (block != null) return block; if (blockId == 0) block = new Air(); else if (blockId == 1) block = new Stone(); else if (blockId == 2) block = new Grass(); else if (blockId == 3) block = new Dirt(); else if (blockId == 4) block = new Cobblestone(); else if (blockId == 5) block = new Planks(); else if (blockId == 6) block = new Sapling(); else if (blockId == 7) block = new Bedrock(); else if (blockId == 8) block = new FlowingWater(); else if (blockId == 9) block = new StationaryWater(); else if (blockId == 10) block = new FlowingLava(); else if (blockId == 11) block = new StationaryLava(); else if (blockId == 12) block = new Sand(); else if (blockId == 13) block = new Gravel(); else if (blockId == 14) block = new GoldOre(); else if (blockId == 15) block = new IronOre(); else if (blockId == 16) block = new CoalOre(); else if (blockId == 17) block = new Log(); else if (blockId == 18) block = new Leaves(); else if (blockId == 19) block = new Sponge(); else if (blockId == 20) block = new Glass(); else if (blockId == 21) block = new LapisOre(); else if (blockId == 22) block = new LapisBlock(); else if (blockId == 23) block = new Dispenser(); else if (blockId == 24) block = new Sandstone(); else if (blockId == 25) block = new NoteBlock(); else if (blockId == 26) block = new Bed(); else if (blockId == 27) block = new GoldenRail(); else if (blockId == 28) block = new DetectorRail(); else if (blockId == 30) block = new Cobweb(); else if (blockId == 31) block = new TallGrass(); else if (blockId == 32) block = new DeadBush(); else if (blockId == 35) block = new Wool(); else if (blockId == 37) block = new YellowFlower(); else if (blockId == 38) block = new Flower(); else if (blockId == 39) block = new BrownMushroom(); else if (blockId == 40) block = new RedMushroom(); else if (blockId == 41) block = new GoldBlock(); else if (blockId == 42) block = new IronBlock(); else if (blockId == 43) block = new DoubleStoneSlab(); else if (blockId == 44) block = new StoneSlab(); else if (blockId == 45) block = new Bricks(); else if (blockId == 46) block = new Tnt(); else if (blockId == 47) block = new Bookshelf(); else if (blockId == 48) block = new MossStone(); else if (blockId == 49) block = new Obsidian(); else if (blockId == 50) block = new Torch(); else if (blockId == 51) block = new Fire(); else if (blockId == 52) block = new MonsterSpawner(); else if (blockId == 53) block = new OakWoodStairs(); else if (blockId == 54) block = new Chest(); else if (blockId == 55) block = new RedstoneWire(); else if (blockId == 56) block = new DiamondOre(); else if (blockId == 57) block = new DiamondBlock(); else if (blockId == 58) block = new CraftingTable(); else if (blockId == 59) block = new Wheat(); else if (blockId == 60) block = new Farmland(); else if (blockId == 61) block = new Furnace(); else if (blockId == 62) block = new LitFurnace(); else if (blockId == 63) block = new StandingSign(); else if (blockId == 64) block = new WoodenDoor(); else if (blockId == 65) block = new Ladder(); else if (blockId == 66) block = new Rail(); else if (blockId == 67) block = new CobblestoneStairs(); else if (blockId == 68) block = new WallSign(); else if (blockId == 69) block = new Lever(); else if (blockId == 70) block = new StonePressurePlate(); else if (blockId == 71) block = new IronDoor(); else if (blockId == 72) block = new WoodenPressurePlate(); else if (blockId == 73) block = new RedstoneOre(); else if (blockId == 74) block = new LitRedstoneOre(); else if (blockId == 75) block = new UnlitRedstoneTorch(); else if (blockId == 76) block = new RedstoneTorch(); else if (blockId == 77) block = new StoneButton(); else if (blockId == 78) block = new SnowLayer(); else if (blockId == 79) block = new Ice(); else if (blockId == 80) block = new Snow(); else if (blockId == 81) block = new Cactus(); else if (blockId == 82) block = new Clay(); else if (blockId == 83) block = new Reeds(); else if (blockId == 85) block = new Fence(); else if (blockId == 86) block = new Pumpkin(); else if (blockId == 87) block = new Netherrack(); else if (blockId == 88) block = new SoulSand(); else if (blockId == 89) block = new Glowstone(); else if (blockId == 90) block = new Portal(); else if (blockId == 91) block = new LitPumpkin(); else if (blockId == 92) block = new Cake(); else if (blockId == 93) block = new UnpoweredRepeater(); else if (blockId == 94) block = new PoweredRepeater(); else if (blockId == 95) block = new InvisibleBedrock(); else if (blockId == 96) block = new Trapdoor(); else if (blockId == 97) block = new MonsterEgg(); else if (blockId == 98) block = new StoneBrick(); else if (blockId == 99) block = new BrownMushroomBlock(); else if (blockId == 100) block = new RedMushroomBlock(); else if (blockId == 101) block = new IronBars(); else if (blockId == 102) block = new GlassPane(); else if (blockId == 103) block = new Melon(); else if (blockId == 106) block = new Vine(); else if (blockId == 107) block = new FenceGate(); else if (blockId == 108) block = new BrickStairs(); else if (blockId == 109) block = new StoneBrickStairs(); else if (blockId == 110) block = new Mycelium(); else if (blockId == 111) block = new Waterlily(); else if (blockId == 112) block = new NetherBrick(); else if (blockId == 113) block = new NetherBrickFence(); else if (blockId == 114) block = new NetherBrickStairs(); else if (blockId == 115) block = new NetherWart(); else if (blockId == 116) block = new EnchantingTable(); else if (blockId == 117) block = new BrewingStand(); else if (blockId == 120) block = new EndPortalFrame(); else if (blockId == 121) block = new EndStone(); else if (blockId == 122) block = new LitRedstoneLamp(); else if (blockId == 123) block = new RedstoneLamp(); else if (blockId == 126) block = new ActivatorRail(); else if (blockId == 127) block = new Cocoa(); else if (blockId == 128) block = new SandStoneStairs(); else if (blockId == 129) block = new EmeraldOre(); else if (blockId == 131) block = new TripwireHook(); else if (blockId == 132) block = new Tripwire(); else if (blockId == 133) block = new EmeraldBlock(); else if (blockId == 134) block = new SpruceWoodStairs(); else if (blockId == 135) block = new BirchWoodStairs(); else if (blockId == 136) block = new JungleWoodStairs(); else if (blockId == 139) block = new CobblestoneWall(); else if (blockId == 140) block = new FlowerPot(); else if (blockId == 141) block = new Carrots(); else if (blockId == 142) block = new Potatoes(); else if (blockId == 143) block = new WoodenButton(); else if (blockId == 144) block = new Skull(); else if (blockId == 145) block = new Anvil(); else if (blockId == 146) block = new TrappedChest(); else if (blockId == 147) block = new LightWeightedPressurePlate(); else if (blockId == 148) block = new HeavyWeightedPressurePlate(); else if (blockId == 151) block = new DaylightDetector(); else if (blockId == 152) block = new RedstoneBlock(); else if (blockId == 153) block = new QuartzOre(); else if (blockId == 155) block = new QuartzBlock(); else if (blockId == 156) block = new QuartzStairs(); else if (blockId == 157) block = new DoubleWoodSlab(); else if (blockId == 158) block = new WoodSlab(); else if (blockId == 159) block = new StainedHardenedClay(); else if (blockId == 161) block = new AcaciaLeaves(); else if (blockId == 162) block = new AcaciaLog(); else if (blockId == 163) block = new AcaciaStairs(); else if (blockId == 164) block = new DarkOakStairs(); else if (blockId == 167) block = new IronTrapdoor(); else if (blockId == 170) block = new HayBlock(); else if (blockId == 171) block = new Carpet(); else if (blockId == 172) block = new HardenedClay(); else if (blockId == 173) block = new CoalBlock(); else if (blockId == 174) block = new PackedIce(); else if (blockId == 175) block = new Sunflower(); else if (blockId == 178) block = new DaylightDetectorInverted(); else if (blockId == 183) block = new SpruceFenceGate(); else if (blockId == 184) block = new BirchFenceGate(); else if (blockId == 185) block = new JungleFenceGate(); else if (blockId == 186) block = new DarkOakFenceGate(); else if (blockId == 187) block = new AcaciaFenceGate(); else if (blockId == 198) block = new GrassPath(); else if (blockId == 199) block = new ItemFrame(); else if (blockId == 243) block = new Podzol(); else if (blockId == 244) block = new Beetroot(); else if (blockId == 245) block = new Stonecutter(); else if (blockId == 246) block = new GlowingObsidian(); else if (blockId == 247) block = new NetherReactorCore(); else { // Log.DebugFormat(@" // // Add this missing block to the BlockFactory // else if (blockId == {1}) block = new {0}(); // // public class {0} : Block // {{ // internal {0}() : base({1}) // {{ // }} // }} //", "Missing", blockId); block = new Block(blockId); } return block; }
void OnTriggerEnter2D(Collider2D other) { if (other.tag == "lever") { lever = other.GetComponent<Lever>(); canPull = true; } if (other.tag== "ground"){ transform.parent = other.transform; } if (other.tag == "nextLevel") { SceneManager.LoadScene("Level2"); } if(other.tag =="unlock") { unlock = other.GetComponent<AbilityUnlock>(); touching=true; } }
private Tile LoadLeverTile(int x, int y) { GameObjectList levers = this.Find("levers") as GameObjectList; TileField tiles = this.Find("tiles") as TileField; Lever lever = new Lever(); lever.Origin = new Vector2(0, lever.Height); lever.Position = new Vector2(x * tiles.CellWidth, (y+1) * tiles.CellHeight); levers.Add(lever); return new Tile(); }