// Setting up references void Awake() { obstacleSpawner = GameObject.FindGameObjectWithTag("ObstacleSpawner").GetComponent<ObstacleSpawner>(); pickupSpawner = GameObject.FindGameObjectWithTag("PickupSpawner").GetComponent<PickupSpawner>(); soundManager = GameObject.FindGameObjectWithTag("SoundManagerGO").GetComponent<SoundManager>(); playerControls = player.GetComponent<CharacterUserControls>(); }
// Use this for initialization void Start() { startingX = (int)transform.position.x; scoreText = GameObject.Find("Score").guiText; lifeText = GameObject.Find("Life").guiText; obstacleSpawner = GameObject.Find("ChunkManager").GetComponent <ObstacleSpawner>(); }
private void Awake() { if (!instance) { instance = this; } }
void CreateInstance() { if (instance == null) { instance = this; } }
void Start() { var spawnerObject = GameObject.FindWithTag("GameController"); spawner = spawnerObject.GetComponent <ObstacleSpawner>(); GetComponent <Rigidbody2D>().velocity = velocity; }
public IEnumerator spawns_objects_at_spawn_rate() { // Arrange GameObject spawnManagerObject = new GameObject("SpawnManager"); SpawnManager spawnManager = spawnManagerObject.AddComponent <SpawnManager>(); ObstacleSpawner obstacleSpawner = spawnManagerObject.AddComponent <ObstacleSpawner>(); spawnManager.ObstacleSpawner = obstacleSpawner; spawnManager.ObstacleSpawner.SpawnRate = 0.30f; spawnManager.ObstacleSpawner.SpawnData.SpawnStartTime = 0.0f; spawnManager.ObstacleSpawner.SpawnData.PoolSize = 5; spawnManager.ObstacleSpawner.SpawnData.Prefabs = new GameObject[1]; spawnManager.ObstacleSpawner.SpawnData.Prefabs[0] = CreateObstacle(Vector3.zero); // Act yield return(new WaitForSeconds(1.0f)); // Assert Assert.AreEqual(4, spawnManager.ObstacleSpawner.NumberSpawned); // Clean spawnManagerObject.SetActive(false); }
public IEnumerator creates_three_obstacle_pools_when_given_three_prefabs() { // Arrange GameObject spawnManagerObject = new GameObject("Spawn Manager"); SpawnManager spawnManager = spawnManagerObject.AddComponent <SpawnManager>(); ObstacleSpawner obstacleSpawner = spawnManagerObject.AddComponent <ObstacleSpawner>(); spawnManager.ObstacleSpawner = obstacleSpawner; spawnManager.ObstacleSpawner.SpawnData.Prefabs = new GameObject[3]; spawnManager.ObstacleSpawner.SpawnData.Prefabs[0] = CreateObstacle(Vector3.zero); spawnManager.ObstacleSpawner.SpawnData.Prefabs[1] = CreatePole(Vector3.zero); spawnManager.ObstacleSpawner.SpawnData.Prefabs[2] = CreateWaste(Vector3.zero); // Act yield return(new WaitForSeconds(0.3f)); // Assert Assert.IsTrue(spawnManager.ObstacleSpawner.Pools[0] != null); Assert.IsTrue(spawnManager.ObstacleSpawner.Pools[1] != null); Assert.IsTrue(spawnManager.ObstacleSpawner.Pools[2] != null); // Clean spawnManagerObject.SetActive(false); }
void Start() { cart = GameObject.Find("Cart"); setCube(); spawner = GameObject.Find("Obstacle Spawner").GetComponent<ObstacleSpawner>(); }
public IEnumerator instantiates_30_pool_objects_when_given_three_prefabs_and_10_prefab_pool_size() { // Arrange GameObject spawnManagerObject = new GameObject("Spawn Manager"); SpawnManager spawnManager = spawnManagerObject.AddComponent <SpawnManager>(); ObstacleSpawner obstacleSpawner = spawnManagerObject.AddComponent <ObstacleSpawner>(); spawnManager.ObstacleSpawner = obstacleSpawner; spawnManager.ObstacleSpawner.SpawnData.Prefabs = new GameObject[3]; spawnManager.ObstacleSpawner.SpawnData.PoolSize = 10; spawnManager.ObstacleSpawner.SpawnData.Prefabs[0] = CreateObstacle(Vector3.zero); spawnManager.ObstacleSpawner.SpawnData.Prefabs[1] = CreatePole(Vector3.zero); spawnManager.ObstacleSpawner.SpawnData.Prefabs[2] = CreateWaste(Vector3.zero); // Act yield return(new WaitForSeconds(0.3f)); // Assert Assert.AreEqual(30, spawnManager.transform.childCount); // Clean spawnManagerObject.SetActive(false); }
void Start() { this.rigidbody.velocity = new Vector3(60, 0, 0); spawner = GameObject.Find("Obstacle Spawner").GetComponent <ObstacleSpawner>(); niceShot = GameObject.Find("Nice_Shot_Popup").GetComponent <ParticleSystem>(); increase = GameObject.Find("Increase_Score").GetComponent <ParticleSystem>(); }
public void Init() { ObstacleCreateDelay = Random.Range(3.0f, 5.0f); ObstacleCreateTimer = ObstacleCreateDelay; leftObstacleDelay = Random.Range(3.0f, 10.0f); rightObstacleDelay = Random.Range(3.0f, 10.0f); leftObstacleTimer = leftObstacleDelay; rightObstacleTimer = rightObstacleDelay; instance = this; for (int i = 0; i < obstacles.Length; i++) { for (int j = 0; j < obstacles[i].obstacle.Count; j++) { obstacles[i].obstacle[j].GetComponent <ObstacleScript>().SetIndex(i, j); if (!obstacles[i].obstacle[j].activeInHierarchy) { InactiveObstacles[i].obstacle.Add(obstacles[i].obstacle[j]); } } } for (int i = 0; i < leftObstacle.Length; i++) { leftObstacle[i].SetActive(false); leftInactiveObstacle.Add(leftObstacle[i]); } for (int i = 0; i < rightObstacle.Length; i++) { rightObstacle[i].SetActive(false); rightInactiveObstacle.Add(rightObstacle[i]); } }
public IEnumerator spawned_obstacle_is_passed_to_dog_focus_queue() { // Arrange GameObject spawnManagerObject = new GameObject("Spawn Manager"); SpawnManager spawnManager = spawnManagerObject.AddComponent <SpawnManager>(); ObstacleSpawner obstacleSpawner = spawnManagerObject.AddComponent <ObstacleSpawner>(); spawnManager.ObstacleSpawner = obstacleSpawner; spawnManager.ObstacleSpawner.SpawnData.PoolSize = 3; spawnManager.ObstacleSpawner.SpawnData.Prefabs = new GameObject[1]; spawnManager.ObstacleSpawner.SpawnData.Prefabs[0] = CreateObstacle(Vector3.zero); GameObject dogGameObject = new GameObject("Dog"); dogGameObject.transform.position = Vector3.zero; DogCharacter dog = dogGameObject.AddComponent <DogCharacter>(); spawnManager.ObstacleSpawner.Dog = dog; // Act yield return(new WaitForSeconds(0.3f)); spawnManager.ObstacleSpawner.RandomObstacleSpawn(); // Assert Assert.AreEqual("Obstacle", dog.CurrentObject.transform.tag); // Clean spawnManagerObject.SetActive(false); dogGameObject.SetActive(false); }
// Start is called before the first frame update void Start() { elapsedSeconds = 0;//set the elapsed seconds to 0 at the start of the level playerMovement = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>(); obstacleSpawner = GameObject.Find("obstacles").GetComponent <ObstacleSpawner>(); }
public void Respawn(Vector2 position, Vector2 size, Vector2 speed, float rotationSpeed, Color colour, uint score, int ID, ObstacleSpawner spawner, bool harmfull = true) { passed = false; rigidbody.velocity = Vector2.zero; rigidbody.angularVelocity = 0; transform.position = position; transform.rotation = Quaternion.identity; start = position; this.speed = speed; this.speed.x *= (Random.Range(0, 2) * 2 - 1); this.speed.y *= (Random.Range(0, 2) * 2 - 1); this.rotationSpeed = rotationSpeed * (Random.Range(0, 2) * 2 - 1); this.ID = ID; SetSize(size); SetColour(colour); this.score = score; this.harmfull = harmfull; this.spawner = spawner; }
public void Init(int i, ref Vector3 _pos, ref Vector3 _rota) { obstacleSpawner = this.gameObject.GetComponent <ObstacleSpawner>(); obstacleSpawner.Init(); Spawn(i, ref _pos, ref _rota); }
void Start() { this.rigidbody.velocity = new Vector3(60, 0, 0); spawner = GameObject.Find("Obstacle Spawner").GetComponent<ObstacleSpawner>(); niceShot = GameObject.Find("Nice_Shot_Popup").GetComponent<ParticleSystem>(); increase = GameObject.Find("Increase_Score").GetComponent<ParticleSystem>(); }
public void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { startingX = (int) transform.position.x; scoreText = GameObject.Find("Score").guiText; lifeText = GameObject.Find("Life").guiText; obstacleSpawner = GameObject.Find("ChunkManager").GetComponent<ObstacleSpawner>(); }
void Start() { obstacleSpawner = GetComponent <ObstacleSpawner>(); spawnData = GetComponent <SpawnData>(); // player = GetComponent<GameObject>(); SetupNextStage(); }
// Use this for initialization void Start() { adManager = FindObjectOfType <AdManager>(); GetScore(); Debug.Log("playCount: " + playCount); Time.timeScale = 0; if (playCount > 3) { int randomChance = Random.Range(0, 2); Debug.Log(randomChance); if (randomChance == 1) { adManager.ShowStandardVideoAd(); playCount = 0; } } Time.timeScale = 1; flappy = GameObject.Find("Flappy"); flappyController = flappy.GetComponent <FlappyController>(); flappyRB = flappy.GetComponent <Rigidbody2D>(); startCanvas = GameObject.Find("StartCanvas"); gameOverCanvas = GameObject.Find("GameOverCanvas"); gameOverCanvas.SetActive(false); obstacleSpawner = GameObject.Find("ObstacleSpawner"); os = obstacleSpawner.GetComponent <ObstacleSpawner>(); sc = gameOverCanvas.GetComponent <ScoreCounter>(); score = 0; UpdateScore(); }
public static void AddScore(int amount) { score += amount; float playerForwardVelocity = PlayerController.GetForwardVelocity(); if (playerForwardVelocity < 70f) { PlayerController.SetForwardVelocity(playerForwardVelocity * 1.25f * totalMult); } PlayerController.SetAngularVelocity(PlayerController.GetAngularVelocity() * 1.01f * totalMult); float spawnInterval = ObstacleSpawner.GetSpawnInterval(); if (spawnInterval > 10f) { ObstacleSpawner.SetSpawnInterval(spawnInterval - 0.1f * totalMult); } float holeRatioMin = ObstacleSpawner.GetHoleMin(); float holeRatioMax = ObstacleSpawner.GetHoleMax(); if (holeRatioMin > 0.2f) { ObstacleSpawner.SetHoleMin(holeRatioMin - 0.05f); ObstacleSpawner.SetHoleMax(holeRatioMax - 0.05f); } float rotationMultiplier = ObstacleBehaviour.GetRotationMultiplier(); if (rotationMultiplier < 50.0f) { ObstacleBehaviour.SetRotationMultiplier(rotationMultiplier + 0.05f * totalMult); } }
void Start() { os = FindObjectOfType <ObstacleSpawner>(); dc = FindObjectOfType <DudeController>(); a = GetComponent <Animator>(); sc = FindObjectOfType <SpeedControl>(); }
void Start() { cart = GameObject.Find("Cart"); setCube(); spawner = GameObject.Find("Obstacle Spawner").GetComponent <ObstacleSpawner>(); }
void Start() { //get the width of the scrollable object SpriteRenderer[] srs = this.gameObject.GetComponentsInChildren <SpriteRenderer>(); bounds = new Bounds(this.transform.position, Vector3.zero); foreach (SpriteRenderer renderer in srs) { bounds.Encapsulate(renderer.bounds); } tileSizeX = bounds.size.x - screenWidth; //get the startposition Transform startTransform = GetComponent <Transform>(); startPosition.x = startTransform.position.x; startPosition.y = startTransform.position.y; //objCreationControl = true; isObjCreated = false; bgSpawner = FindObjectOfType <BGSpawner>(); obstacleSpawner = FindObjectOfType <ObstacleSpawner>(); coinSpawner = FindObjectOfType <CoinSpawner>(); gameEngine = FindObjectOfType <GameEngine>(); currentSpeedFactor = gameEngine.speedFactor; }
private void Awake() { if (instance == null) { instance = this; } }
private void Start() { os = FindObjectOfType <ObstacleSpawner>(); speed = os.obstacleSpeed; sr = GetComponent <SpriteRenderer>(); }
void Start() { spinSpeed = Random.Range(-15, 15); var spawnerObject = GameObject.FindWithTag("GameController"); spawner = spawnerObject.GetComponent <ObstacleSpawner>(); GetComponent <Rigidbody2D>().velocity = velocity; }
void Start() { //link scripts ui = Camera.main.GetComponent <GameUI> (); spawner = Camera.main.GetComponent <ObstacleSpawner> (); player = GameObject.FindGameObjectWithTag("Player"); rocketMan = player.GetComponent <RocketMan> (); }
private void Start() { eventSystem = GameObject.Find("EventSystem").GetComponent <EventSystem>(); playerSpawner = GetComponent <PlayerSpawner>(); obstacleSpawner = GameObject.Find("ObstacleSpawner").GetComponent <ObstacleSpawner>(); obstacleSpawner.gameObject.SetActive(false); SetState(State.MainMenu); }
void Awake() { if (instance == null) { instance = this; } initObstacles(); }
void Start() { player = GameObject.Find("Player"); campSpawnerScript = GameObject.Find("CampSpawner").GetComponent <CampSpawner>(); obstacleSpawnerScript = GameObject.Find("ObstacleSpawner").GetComponent <ObstacleSpawner>(); //fuelSpawnerScript = GameObject.Find("FuelSpawner").GetComponent<FuelSpawner>(); //cogSpawnerScript = GameObject.Find("CogSpawner").GetComponent<CogSpawner>(); }
// Start is called before the first frame update void Start() { StartCoroutine("Shooting"); StartValues(); audioSource = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); spawner = GameObject.FindGameObjectWithTag("GameManager").GetComponent <ObstacleSpawner>(); manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); }
public void UpdateTest() { ArenaFacade.Instance.UpdateDimensions(new Vector2(0, 0), new Vector2(0, 0), new Vector2(0, 0), 10f); ArenaObjectSpawner spawner = new ObstacleSpawner(GameData.ObstacleSpawnerParams, new AbstractArenaObjectFactory[] { new NonPassableArenaObjectFactory() }); GameManager.Instance.SetTimeSinceLastFrame(0.69f); spawner.Update(); Assert.IsTrue(spawner.Time.Equals(0.69f)); }
public void SpawnTest() { ArenaObjectSpawner spawner = new ObstacleSpawner(GameData.ObstacleSpawnerParams, new AbstractArenaObjectFactory[] { new NonPassableArenaObjectFactory() }); // a long time ensures spawning GameManager.Instance.SetTimeSinceLastFrame(100f); spawner.Update(); Assert.IsTrue(ArenaFacade.Instance.ArenaObjects.Count > 0); }
void Start() { spawner = GameObject.FindGameObjectWithTag("ObstacleSpawner").GetComponent<ObstacleSpawner>(); player = GameObject.FindGameObjectWithTag("Player").transform; thisTransform = transform; startPosition = thisTransform.position; if(SpawnOnStart) { spawner.SpawnNew(thisTransform.position.x); } }
// Use this for initialization void Start() { //Initialize shipInfo = ScriptableObject.CreateInstance<ShipData>(); defaultDrag = rigidbody.drag; lightSpeedEffect = transform.Find("Light Speed Effect").particleSystem; engine = GetComponent<Engine>() as Engine; lineRendererToLauncher = gameObject.AddComponent<LineRenderer>(); asteroidSpawner = GetComponent<ObstacleSpawner>(); //Set default stuff SetToDefaultState(); }
public static ObstacleSpawner instance; //Instance void Awake(){ instance = this; }
void Awake(){ Instance = this; }
// Initialization event void Start() { //Initialize shipInfo = ScriptableObject.CreateInstance<ShipData>(); defaultDrag = rigidbody.drag; engine = GetComponent<Engine>() as Engine; engine.enabled = false; asteroidSpawner = GetComponent<ObstacleSpawner>(); lootCollector = GetComponent<Looter>(); lootCollector.enabled = false; if(gravityComponent != null) gravityComponent.SetActive(false); //Set default stuff state = new StateMachine<ShipState>(new Orbit(this)); }
public Transit( Ship self, float ftlCounterForce = 0, float timeOfLaunch = 0 ) : base(self) { asteroidSpawner = self.asteroidSpawner; gravityComponent = self.gravityComponent; this.ftlCounterForce = ftlCounterForce; this.timeOfLaunch = timeOfLaunch; this.lootCollector = self.lootCollector; }
void Start() { question = GameObject.Find("Question").GetComponent<Text>(); obstacleSpawner = GameObject.Find("ObstacleSpawner").GetComponent<ObstacleSpawner>(); }