private void Awake() { manager = World.DefaultGameObjectInjectionWorld.EntityManager; blobAssetStore = new BlobAssetStore(); gameStateSystem = manager.World.GetExistingSystem <GameStateSystem>(); }
void Start() { gameStateSystem = SystemCache.Instance.gameStateSystem; stateSystem = SystemCache.Instance.stateSystem; score = ScorePlayer(); timer = wait_time; }
private void MoveSnake(SnakeComponent snake) { bool TooBig = false; for (int i = snake.BodyParts.Count - 1; i >= 0; i--) { SnakePartComponent IteratingPart = snake.BodyParts[i]; if (snake.Increase && i > 1) { //Do Nothing } else if (snake.Increase && i == 1) { GameObject AddedPart = GameObject.Instantiate <GameObject>(snake.BodyPrefab); AddedPart.name = AddedPart.name.Replace("(Clone)", ""); AddedPart.transform.SetParent(snake.transform); AddedPart.transform.position = IteratingPart.transform.position; AddedPart.transform.up = IteratingPart.transform.up; snake.BodyParts.Insert(1, AddedPart.GetComponent <SnakePartComponent>()); snake.Increase = false; snake.Size++; i++; if (snake.Size >= GameSettings.Settings.MaxSnakeSize) { TooBig = true; } } else { if (i > 0) { int NextPartIndex = i - 1; SnakePartComponent NextPart = snake.BodyParts[NextPartIndex]; Vector3 Forward = NextPart.transform.position - IteratingPart.transform.position; IteratingPart.transform.position += Forward; } else { IteratingPart.transform.position += IteratingPart.transform.forward; } } } NormalizePartsRotation(snake); if (CheckForCollisionWithSelf(snake) || CheckForBoundsCollision(snake)) {//EndGame GameStateSystem.EndGame(); } else if (TooBig) { GameStateSystem.EndGame(true); } }
public void OnClick() { //Hide Lobby UIBootstrapComponent.Instance.LobbyPanel.SetActive(false); //Hide GameState UIBootstrapComponent.Instance.GameStatePanel.SetActive(false); //TriggerStart GameStateSystem.Start(); }
void Start() { gameStateSystem = SystemCache.Instance.gameStateSystem; stateSystem = SystemCache.Instance.stateSystem; if (SystemCache.Instance.isReady) { allText = SystemCache.Instance.textData; textDisplayer = SystemCache.Instance.textDisplayer; data = allText.GetComponent <ParseCSV>(); } //SetupTextData(); }
/// <summary> /// Sends messages to gameStateSystem about temperature. /// <summary> public void SendMessage(GameStateSystem gameStateSystem) { gameStateSystem.SetValue(PULL_ENUM, GetComponent <Slider>().value); }
protected override void OnStartRunning() { Instance = this; base.OnStartRunning(); }
// Initiates the game private void preInitGame() { // Variables ModelContentStream mcs; difficulty= 0; pUpdateFunc= defaultUpdateFunc; pRenderFunc= defaultRenderFunc; e_input= null; loadedSounds= new FDictionary<string, Sound>(); loadedTextures= new FDictionary<string, Texture>(); loadedFonts= new FDictionary<string, Font>(); loadedModels= new ModelFactory(); window= new GameFrame(this); GameInput.init(this); content= new ContentManager(); statesys= new GameStateSystem(this); gui= new GUI(this); sounds= new AudioPlayer(this); host= new AServerHost(); mcs= new ModelContentStream(this); content.addReader(new TextureContentReader()); content.addReader(new FontContentReader(this)); content.addReader(new SoundContentReader()); content.addReader(mcs); content.addWriter(mcs); window.viewport.onRender+= render; }