public void SetSpawnersConfig() { Vector3 vector3 = new Vector3(0.0f, 3, 0); GameShapeType[] types = { GameShapeType.CIRCLE, GameShapeType.SQUARE, GameShapeType.TRIANGLE }; GameSpawner spawnerModel1 = new GameSpawner(types, vector3); vector3 = new Vector3(2f, 3, 0); GameSpawner spawnerModel2 = new GameSpawner(types, vector3); vector3 = new Vector3(-2f, 3, 0); GameSpawner spawnerModel3 = new GameSpawner(types, vector3); GameSpawner[] spawnersModel = { spawnerModel1, spawnerModel2, spawnerModel3 }; spawners = spawnersModel; if (onSpawnersUpdated != null) { onSpawnersUpdated(spawners); } StartSpawners(); }
void Start() { boundaryCounter = 0; leftBoundary = GameObject.Find("LeftBoundary").transform; rightBoundary = GameObject.Find("RightBoundary").transform; gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>(); }
void Start() { submarine = GetComponent <Rigidbody2D>(); gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>(); leftBoundary = GameObject.Find("LeftBoundary").transform; rightBoundary = GameObject.Find("RightBoundary").transform; tanks = 2; lives = 2; boostTimer = 3; }
public GameShape(GameShapeType type, GameSpawner spawner, float speed, float spawnSpeed) { PercentualTraveled = 0; Spawner = spawner; this.Type = type; this.Speed = speed; SpawnSpeed = spawnSpeed; this.Position = spawner.SpawnPosition; State = GameShapeState.SPAWNING; }
public static GameShapeSpawnerView CreateSpawnerView(GameObject spawnerPrefab, GameSpawner spawner, GameObject parent, GamePlumbingDragView gamePlumbingDragView, GamePlumbingController gamePlumbingController) { GameObject spawnerObj = Instantiate(spawnerPrefab, spawner.SpawnPosition, Quaternion.identity); spawnerObj.transform.parent = parent.transform; GameShapeSpawnerView component = spawnerObj.AddComponent <GameShapeSpawnerView>(); component.InitSpawner(gamePlumbingDragView, gamePlumbingController, spawner); return(component); }
public void SetPipeFromSpawner(GameSpawner spawner, GamePipeEnd pipeEnd) { if (spawner.AttachedPipe == null) { AddPipe(spawner, pipeEnd); } else { UpdatePipeEnd(spawner.AttachedPipe, pipeEnd); } }
private GamePipe AddPipe(GameSpawner spawner, GamePipeEnd end) { GamePipe newPipe = new GamePipe(spawner, end); pipes.Add(newPipe); spawner.AttachPipe(newPipe); if (onPipeAdded != null) { onPipeAdded(newPipe); } return(newPipe); }
void Start() { gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); spawn.Location = spawnLocation; spawn.timer = timer; if(!inGameUI.isLevel1) { StartBottles(); } }
public GameShape CreateShape(GameShapeType newShapeType, GameSpawner spawner, float speed, float spawnSpeed) { GameShape shape = new GameShape(newShapeType, spawner, speed, spawnSpeed); ShapePipePair newPair = new ShapePipePair { Shape = shape }; Pairs.Add(newPair); return(shape); }
void Start() { gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); if(!inGameUI.isLevel1) { if(!inGameUI.wave1) { StartCoroutine("WaveLabelEnableTimer" , "Wave1Label"); Wave(wave1 , wave1SpawnLocations); } } }
private void Awake() { _canvas = GetComponent <Canvas>(); _canvas.enabled = false; _moneyText = transform.Find("Panel").Find("You Made Text").GetComponent <Text>(); money = GameObject.FindObjectOfType <MoneyManager>(); player = GameObject.FindObjectOfType <Controller>(); spawner = GameObject.FindObjectOfType <GameSpawner>(); button = GetComponentInChildren <Button>(); //environmentCanvas = GameObject.Find("World UI").GetComponent<Canvas>(); }
// Use this for initialization void Start() { startPos = GameObject.FindGameObjectWithTag("CameraStartPos").transform; endPos = GameObject.FindGameObjectWithTag("CameraEndPos").transform; creditPos = GameObject.FindGameObjectWithTag("CameraCreditsPos").transform; camera = GetComponent <Camera>(); money = GameObject.FindObjectOfType <MoneyManager>(); player = GameObject.FindObjectOfType <Controller>(); spawner = GameObject.FindObjectOfType <GameSpawner>(); canvas = GameObject.FindGameObjectWithTag("MainCanvas").GetComponent <Canvas>(); menu = GameObject.FindObjectOfType <MenuCanvas>(); delayParam = delayTime / InterpTime; }
void OnSpawnersUpdated(GameSpawner[] spawners) { if (spawnerObjects != null) { foreach (GameObject spawner in spawnerObjects) { Destroy(spawner); } } spawnerObjects = new GameObject[spawners.Length]; for (int i = 0; i < spawners.Length; i++) { GameSpawner spawn = spawners[i]; spawnerObjects[i] = CreateSpawnerObject(spawn); } }
public void SetToState(GameState gameStateToSet) { if (_currentGameState == GameState.LoadingGame && gameStateToSet == GameState.OnGame) { _currentGameState = gameStateToSet; var gameSpawner = GameSpawner.FindInScene(); gameSpawner.StartGame(_globalPlayers); } else if (_currentGameState == GameState.OnGame && gameStateToSet == GameState.OnWrapUpScreen) { _currentGameState = gameStateToSet; } else if (gameStateToSet == GameState.OnLobby) { _currentGameState = gameStateToSet; } }
protected void SpawnShape(GameSpawner spawner = null) { if (spawner == null) { int spawnerIndex = UnityEngine.Random.Range(0, spawners.Length); spawner = spawners[spawnerIndex]; } GameShapeType newShapeType = spawner.GetRandomShapeType(); GameShape shape = shapeController.CreateShape(newShapeType, spawner, speed, spawnSpeed); spawner.CurrentShapes++; shape.RegisterOnStateChanged(CallShapeStateChanged); if (onShapeCreated != null) { onShapeCreated(shape); } }
public override void OnInspectorGUI() { LoadingSetupTools loadingSetup = target as LoadingSetupTools; if (GUILayout.Button("Load")) { if (!loadingSetup.loadingSetup) { Debug.LogError("Loading Setup is null."); } else { GameObject world = GameObject.Find("World"); if (world) { DestroyImmediate(world); } GameSpawner gameSpawner = new GameSpawner(loadingSetup.loadingSetup); loadingSetup.StartCoroutine(gameSpawner.Load( (progress) => { }, () => { })); } } if (loadingSetup.loadingSetup) { if (GUILayout.Button("Save")) { loadingSetup.loadingSetup.Trees = FindWithTag("Trees"); loadingSetup.loadingSetup.Clouds = FindWithTag("Clouds"); loadingSetup.loadingSetup.Rocks = FindWithTag("Rocks"); EditorUtility.SetDirty(loadingSetup.loadingSetup); AssetDatabase.SaveAssets(); } } base.OnInspectorGUI(); }
private void CheckCanSpawn() { if (currentDelay >= delay) { GameSpawner spawner = GetRandomEmptySpawner(); if (spawner != null) { NoOverlapSpawn(spawner); } } else { foreach (GameSpawner spawner in spawners) { if (spawner.CurrentShapes > 0) { return; } } NoOverlapSpawn(null); } }
private void InitSpawner(GamePlumbingDragView plumbingDragView, GamePlumbingController plumbingController, GameSpawner spawner) { gamePlumbingDragView = plumbingDragView; gamePlumbingController = plumbingController; Spawner = spawner; }
void Start() { goldTimer = goldLifespan; gameSpawnerVariable = GameObject.Find("GameSpawner").GetComponent <GameSpawner>(); }
public GamePipe(GameSpawner spawner, GamePipeEnd startEnd) { this.spawner = spawner; pipeEnd = startEnd; State = GamePipeState.WRONG; }
void Start() { attackDelay = false; bottles = GameObject.Find("BottlesSpawner").GetComponent<BottlesSpawner>(); buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); enemySpawner = GameObject.Find("EnemySpawner").GetComponent<EnemySpawner>(); gameOverObj = GameObject.FindGameObjectWithTag("GO"); gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); killed = false; nappyPad = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPad; nappyPadObj = GameObject.FindGameObjectWithTag("Ammo"); if(nappyPadObj != null) { nappyPadScript = nappyPadObj.GetComponent<NappyPad>(); } nappyPadShadow = GameObject.Find("NappyPadSpawner").GetComponent<NappyPadSpawner>().PF_NappyPadShadow; playerSpawn = GameObject.FindGameObjectWithTag("SpawnBlock").GetComponent<PlayerSpawn>(); sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); laugh = sm.laugh; SetState(0); }
void Start() { enemySpawnerObj = GameObject.Find("EnemySpawner"); gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); if(enemySpawnerObj != null) { enemySpawnerScript = enemySpawnerObj.GetComponent<EnemySpawner>(); } nappyPadSpawnerObj = GameObject.Find("NappyPadSpawner"); if(nappyPadSpawnerObj != null) { nappyPadSpawnerScript = nappyPadSpawnerObj.GetComponent<NappyPadSpawner>(); } //Time.timeScale = 1; GameObject smobj = GameObject.Find("SoundManager"); if(smobj != null) { Debug.Log("Sound Manager Found"); sm = smobj.GetComponent<SoundManager>(); } PF_Bottle = null; if(isLevel1) { StartCoroutine("AppearLabel" , "1. TomatoIcon"); StartCoroutine("AppearLabel" , "PlayerCostLabel"); } secondPlayer = false; }
public void AttachPipeToSpawner(GamePipe pipe, GameSpawner spawner) { spawner.AttachPipe(pipe); }
void Start() { igu = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); menuButtonScript = FindObjectOfType<MenuButton>(); PF_BroccoliBaby = Resources.Load("PF_BroccoliBaby") as GameObject; PF_Cow = Resources.Load("PF_Cow") as GameObject; PF_TomatoBaby = Resources.Load("PF_TomatoBaby") as GameObject; sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); tomatoButtonImage = GameObject.Find("TomatoButton").GetComponent<Image>(); if(gameSpawnScript == null) { gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); } }
private void Start() { gs = GameObject.FindGameObjectWithTag("GameSpawner").GetComponent <GameSpawner>(); }
void Start() { gameSpawnScript = GameObject.Find("GameSpawner").GetComponent<GameSpawner>(); if(gameSpawnScript.level == 2) { cowButton = GameObject.Find("CowButton").GetComponent<Button>(); cowTickImage = GameObject.Find("CowTick").GetComponent<Image>(); } if(gameSpawnScript.level == 3) { broccoliButton = GameObject.Find("BroccoliButton").GetComponent<Button>(); broccoliTickImage = GameObject.Find("BroccoliTick").GetComponent<Image>(); cowButton = GameObject.Find("CowButton").GetComponent<Button>(); cowTickImage = GameObject.Find("CowTick").GetComponent<Image>(); } inGameUIObj = GameObject.Find("InGameUIManager"); tomatoButton = GameObject.Find("TomatoButton").GetComponent<Button>(); tomatoTickImage = GameObject.Find("TomatoTick").GetComponent<Image>(); if(broccoliButton != null) { broccoliButtonColours = broccoliButton.colors; } if(cowButton != null) { cowButtonColours = cowButton.colors; } if(inGameUIObj != null) { inGameUIScript = inGameUIObj.GetComponent<InGameUIManager>(); } if(tomatoButton != null) { tomatoButtonColours = tomatoButton.colors; } sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); }
private void NoOverlapSpawn(GameSpawner spawner) { SpawnShape(spawner); currentDelay = 0; Invoke(CheckSpawnShapeFunction, delay); }
GameObject CreateSpawnerObject(GameSpawner spawner) { return(GameShapeSpawnerView.CreateSpawnerView(spawnerPrefab, spawner, spawnersParent, gamePlumbingDragView, gamePlumbingController).gameObject); }