internal void BeginGame() { _GameWorld = _WorldCreationController.LevelOneLoad(); var vertices = new List <Vector2> { new Vector2(0, 500), new Vector2(50, 500), new Vector2(50, 550), new Vector2(0, 550) }; Body body = new Body(new Polygon(vertices), 1, 0); _Player = new CharacterController(new MapObject(TextureType.NotDrawn, body)); vertices = new List <Vector2> { new Vector2(750, 500), new Vector2(800, 500), new Vector2(800, 550), new Vector2(750, 550) }; body = new Body(new Polygon(vertices), 1, 0); _NpcCaveman = new CaveMan(new MapObject(TextureType.NotDrawn, body)); _NpcController = new NpcController(_WorldCreationController._NodeList, _WorldCreationController._PathList, _NpcCaveman); _GameWorld.Add(_Player._CharacterBody); _GameWorld.Add(_NpcCaveman._CaveManBody); }
protected virtual void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { if (onFire && CaveMan.isHoldingTorch && !CaveMan.isTorchLit) { CaveMan.SetTorchLit(true); } return; } if (!other.gameObject.CompareTag("Torch")) { return; } if (!other.gameObject.GetComponent <Torch>().isLit) { return; } if (burned || onFire) { return; } StarFire(); }
private void OnTriggerEnter2D(Collider2D other) { if (!other.CompareTag("Player")) { return; } CaveMan.SetInWater(true); }
public MainMenu() { if (App.Audio != null) { App.Audio.Remove(); } App.Audio = new HTMLAudioElement("assets/GF.mp3"); Document.Body.AppendChild(App.Audio); App.Audio.Play(); clouds = new Clouds(); Container.AddChild(clouds.Container); var bg = new Sprite(App.Textures.MainMenuBG); Container.AddChild(bg); caveMan = new CaveMan { Container = { Position = new Point(25, 250) } }; Container.AddChild(caveMan.Container); campfire = new Campfire { Container = { Position = new Point(250, 350) } }; Container.AddChild(campfire.Container); title = new Sprite(App.Textures.Title) { Position = new Point(50, 50), Visible = firstTime }; Container.AddChild(title); subTitle = new Sprite(App.Textures.PressSpace) { Anchor = new Point(0.5f, 0.5f), Position = new Point(400, 200), Visible = firstTime }; Container.AddChild(subTitle); onKeyDown = OnKeyDown; if (firstTime) { Document.AddEventListener(EventType.KeyDown, onKeyDown); } else { TriggerIntro(); } FadeIn(firstTime ? 2500 : 500); }