void Awake() { breakableCount = GameObject.FindGameObjectsWithTag("Breakable").Length; soundManager = FindObjectOfType<SoundManager>(); levelManager = FindObjectOfType<LevelManager>(); powerUpManager = FindObjectOfType<PowerUpManager>(); timesHit = 0; }
// Use this for initialization void Awake() { ballController = FindObjectOfType<BallController>(); powerUpManager = FindObjectOfType<PowerUpManager>(); LevelManager.currentLevel = Application.loadedLevel; LevelManager.nextLevel = Application.loadedLevel + 1; ScoreManager.playerScoreAtStart = ScoreManager.playerScore; }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; GameObject.DontDestroyOnLoad(gameObject); } scoreManager = FindObjectOfType<ScoreManager>(); anim = GetComponent<Animator>(); }
public void Start () { infiniteObjectGenerator = InfiniteObjectGenerator.instance; guiManager = GUIManager.instance; dataManager = DataManager.instance; audioManager = AudioManager.instance; powerUpManager = PowerUpManager.instance; missionManager = MissionManager.instance; inputController = InputController.instance; cameraController = CameraController.instance; coinGUICollection = CoinGUICollection.instance; Application.runInBackground = runInBackground; activeCharacter = -1; spawnCharacter(); spawnChaseObject(); }
private void Start() { instance = this; StartSpawningPowerups(); }
// Use this for initialization void Start() { currentHealth = maxHealth; _powerUpManager = GameObject.FindObjectOfType <PowerUpManager>(); }
public void Awake() { instance = this; }
public BoostState(PlayerVariables _pVar) { this._pVar = _pVar; _pMan = _pVar.GetComponent <PowerUpManager>(); }
// Use this for initialization void Awake() { m_gameOverText = m_gameOverRef.GetComponentInChildren <Text>(); m_mainCameraRef = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <FollowCenter>(); m_powerUpManagerRef = GameObject.FindGameObjectWithTag("PowerUpManager").GetComponent <PowerUpManager>(); }
// Use this for initialization void Start() { Instance = this; powerUp = new GameObject[] { healthUp, fireRateUp }; }
// Use this for initialization void Awake() { s = this; }
public void Init() { // deprecated variables warnings: if (jumpForce != 0 && jumpHeight == 0) { Debug.LogError("PlayerController.jumpForce is deprecated. Use jumpHeight instead."); jumpHeight = jumpForce; } if (jumpDownwardForce != 0 && gravity == 0) { Debug.LogError("PlayerController.jumpDownwardForce is deprecated. Use gravity instead."); gravity = jumpDownwardForce; } // rigidbody should no longer use gravity, be kinematic, and freeze all constraints Rigidbody playerRigibody = GetComponent <Rigidbody>(); if (playerRigibody != null) { if (playerRigibody.useGravity) { Debug.LogError("The rigidbody no longer needs to use gravity. Disabling."); playerRigibody.useGravity = false; } if (!playerRigibody.isKinematic) { Debug.LogError("The rigidbody should be kinematic. Enabling."); playerRigibody.isKinematic = true; } if (playerRigibody.constraints != RigidbodyConstraints.FreezeAll) { Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics."); playerRigibody.constraints = RigidbodyConstraints.FreezeAll; } } cameraController = CameraController.instance; infiniteObjectGenerator = InfiniteObjectGenerator.instance; powerUpManager = PowerUpManager.instance; gameManager = GameManager.instance; if (attackType == AttackType.Projectile) { projectileManager = GetComponent <ProjectileManager>(); } platformLayer = 1 << LayerMask.NameToLayer("Platform"); floorLayer = 1 << LayerMask.NameToLayer("Floor"); wallLayer = 1 << LayerMask.NameToLayer("Wall"); obstacleLayer = 1 << LayerMask.NameToLayer("Obstacle"); thisTransform = transform; capsuleCollider = GetComponent <CapsuleCollider>(); playerAnimation = GetComponent <PlayerAnimation>(); playerAnimation.Init(); startPosition = thisTransform.position; startRotation = thisTransform.rotation; slideData = new CoroutineData(); stumbleData = new CoroutineData(); forwardSpeeds.Init(); // determine the fastest and the slowest forward speeds forwardSpeeds.GetMinMaxValue(out minForwardSpeed, out maxForwardSpeed); forwardSpeedDelta = maxForwardSpeed - minForwardSpeed; if (forwardSpeedDelta == 0) { playerAnimation.SetRunSpeed(1, 1); } ResetValues(false); enabled = false; }
// Use this for initialization void start() { ThePowerUpManager = FindObjectOfType <PowerUpManager>(); }
// Use this for initialization private void Start() { var ratio = (float)Screen.width / Screen.height; // Debug.Log("Aspect ratio is " + ratio); if (closeTo(ratio, 18 / 9f, 0.01f)) { Adjust3dGUIToWideScreen(); } _backgroundParticles = GameObject.Find("Background Particle System") .GetComponent <ParticleSystem>(); _backgroundParticlesBright = GameObject .Find("Background Particle System Bright") .GetComponent <ParticleSystem>(); _magnetismParticles = GameObject .Find("GrandDaddy/Player Animation Parent/Magnet Particle System") .GetComponent <ParticleSystem>(); _projectilesParticles = GameObject .Find("GrandDaddy/Projectiles Particle System") .GetComponent <ParticleSystem>(); _playerExplosionParticles = GameObject .Find("GrandDaddy/Player Animation Parent/Boost Stretcher/Player") .GetComponent <ParticleSystem>(); _playerDebrisParticles = GameObject .Find("GrandDaddy/Player Animation Parent/Debris Particle System") .GetComponent <ParticleSystem>(); _scoreCanvas = GameObject.Find("ScoreCanvas"); _powerUpManager = GameObject.Find("Power Up Manager") .GetComponent <PowerUpManager>(); _livesLeftText = GameObject.Find("ScoreCanvas/Lives Count") .GetComponent <TextMeshProUGUI>(); _livesLeftTextAnim = GameObject.Find("ScoreCanvas/Lives Count") .GetComponent <Animator>(); _livesLeftKyoobParentAnim = GameObject .Find("Lives Count Kyoob Parent").GetComponent <Animator>(); _pauseMenuAnim = GameObject.Find("GrandDaddy").GetComponent <Animator>(); _camAnim = Camera.main.GetComponent <Animator>(); Timer = new GameTimer(_powerUpManager.BoostPowerUpDuration, _powerUpManager.DestructionPowerUpDuration, _powerUpManager.MagnetPowerUpDuration, _powerUpManager.ProjectilesPowerUpDuration, _powerUpManager.ExplosionPowerUpDuration); _instructions1 = GameObject.Find("instructions1").GetComponent <Renderer>(); _instructions2 = GameObject.Find("instructions2").GetComponent <Renderer>(); _isEscKeyReleased = true; _playerScript = GameObject.Find( "GrandDaddy/Player Animation Parent/Boost Stretcher/Player") .GetComponent <PlayerScriptWithAnimator>(); _audioManager = GameObject.Find("Audio Manager") .GetComponent <AudioManager>(); _audioManager.FirstGameFrame = true; Broadcasts = new List <GameObject>(); ScoreStreakObj = new ScoreStreak(); if (_playerScript == null) { Debug.LogWarning("_scoreStreak is null"); } }
private void Awake() { Instance = this; spawnedPowerUps = new List <PowerUp>(); }
// Use this for initialization void Start() { _powerUpManager = GameObject.FindObjectOfType <PowerUpManager>(); }
//swaps the tower model to the one defined in the corresponding upgrade option public void TowerChange() { //instantiate new tower model at the same position and reparent it to the Tower Manager object GameObject newTower = (GameObject)Instantiate(options[curLvl].swapModel, transform.position, transform.rotation); newTower.transform.parent = GameObject.Find("Tower Manager").transform; //find the TowerBase component, we have to do some adjustments to it TowerBase newTowerBase = newTower.GetComponentInChildren <TowerBase>(); //get the gameobject which holds the TowerBase script, //and rename it to keep the old name GameObject subTower = newTowerBase.gameObject; newTower.name = newTowerBase.gameObject.name = transform.name; //attach and store an Upgrade script to the actual tower object, //copy values from the old tower Upgrade newUpgrade = subTower.AddComponent <Upgrade>(); newUpgrade.curLvl = this.curLvl; newUpgrade.options = this.options; newTowerBase.upgrade = newUpgrade; //apply passive powerups to new tower PowerUpManager.ApplyToSingleTower(newTowerBase, newUpgrade); //switch TowerBase component to active state - attacks enemies newTowerBase.enabled = true; newTowerBase.rangeInd.renderer.enabled = true; //abort shot automatism of the new tower, //in order to take the last shot time of the old tower into account newTowerBase.CancelInvoke("CheckRange"); float lastShot = towerScript.lastShot; float invokeInSec = options[curLvl].shootDelay + lastShot - Time.time; if (invokeInSec < 0) { invokeInSec = 0f; } newTowerBase.StartInvoke(invokeInSec); //find GUI component and assign new upgrade script, //we do this in order to update the upgrade gui tooltip for the new tower GUILogic gui = GameObject.Find("GUI").GetComponent <GUILogic>(); gui.upgrade = newUpgrade; //signalize enemies that the old tower was despawned, //here we loop through all enemies in range and remove the old tower from them. //they detect the new tower automatically, since enemies are colliding with it. for (int i = 0; i < towerScript.inRange.Count; i++) { PoolManager.Props[towerScript.inRange[i].name].RemoveTower(towerScript); } //re-rotate turret to match the old turret, if there existed one, //else rotate turret to match the grid rotation if (newTowerBase.turret) { if (towerScript.turret) { newTowerBase.turret.rotation = towerScript.turret.rotation; } else { //define ray with down direction to get the grid beneath Ray ray = new Ray(transform.position + new Vector3(0, 0.5f, 0), -transform.up); RaycastHit hit; //raycast downwards of the tower against our grid mask to get the grid if (Physics.Raycast(ray, out hit, 20, SV.gridMask)) { Transform grid = hit.transform; newTowerBase.turret.rotation = grid.rotation; } } //don't let the tower/turret rotation affect shot position rotation newTowerBase.shotPos.localRotation = Quaternion.identity; //enable turret rotation mechanism newTowerBase.turret.GetComponent <TowerRotation>().enabled = true; } //destroy (this) old tower Destroy(transform.parent.gameObject); }
private void Awake() { audioSource = GameObject.FindGameObjectWithTag("audiosource_powerup").GetComponent <AudioSource>(); powerUpManager_1 = GameObject.FindGameObjectWithTag("pw_manager_p1").GetComponent <PowerUpManager>(); powerUpManager_2 = GameObject.FindGameObjectWithTag("pw_manager_p2").GetComponent <PowerUpManager>(); }
void Awake() { instance = this; }
public void UpdatePowerUpVelocity() { rb.velocity = totalSpeed * PowerUpManager.GetBallSpeedMult(); }
public virtual void PowerUp() { PowerUpManager.DeployPowerUp(powerUp); CenterQirn.Instance.AddScore(_worth); StartCoroutine(PowerUpThenPool()); }
void Start() { powerUpManager = GameObject.Find("PowerUpManager").GetComponent <PowerUpManager>(); }
private void Start() { abilityCanvas = GameObject.FindGameObjectsWithTag("AbilitieManager")[0];; manager = abilityCanvas.GetComponent <PowerUpManager>(); mc = GameObject.FindGameObjectWithTag("Generator").GetComponent <ModulesCount>(); }
//pickup powerups public void SetPowerUpsPriority() { List <int> powerUpsPriorities = new List <int>(); if (aiPowerUpLogic.itemPowerUps.Count == 0) { pickPowerUpPriority = 0; return; } int highestPriority = 0; foreach (GameObject powerUp in aiPowerUpLogic.itemPowerUps) { PowerUpManager manager = powerUp.GetComponent <PowerUpManager>(); if (manager == null) { return; } float distanceFromMe = aiMapLogic.GetDistance(aiBase.gameObject, powerUp); float distanceFactor = aiMapLogic.GetDistanceFactor(distanceFromMe); int priority = 0; switch (manager.type) { case PowerUpEnum.Ammo: float ammoFactor = distanceFactor * aiBase.weaponHandling.activeWeapon.ammo / aiBase.weaponHandling.activeWeapon.clip; priority = (int)ammoFactor * 10; break; case PowerUpEnum.Heal: float healthFactor = distanceFactor * aiBase.hitPoints / aiBase.GetMaxHp(); priority = (int)healthFactor * 10; break; case PowerUpEnum.Mystery: int mysteryFactor = (int)distanceFactor * Random.Range(0, 80); mysteryFactor += (int)distanceFactor * 25; priority = mysteryFactor; break; case PowerUpEnum.Shield: float shieldFactor = distanceFactor * (50 + Random.Range(0, 20)); priority = (int)shieldFactor; break; case PowerUpEnum.Speed: float speedFactor = distanceFactor * (50 + Random.Range(0, 20)); priority = (int)speedFactor; break; } if (priority == 0) { priority = 10; } powerUpsPriorities.Add(priority); if (powerUpsPriorities[powerUpsPriorities.Count - 1] > highestPriority) { highestPriority = powerUpsPriorities[powerUpsPriorities.Count - 1]; } } aiPowerUpLogic.bestPowerUp = aiPowerUpLogic.itemPowerUps[powerUpsPriorities.IndexOf(highestPriority)]; pickPowerUpPriority = highestPriority; }
private void Awake() { _instance = this; }
void Start() { thePowerUpManager = FindObjectOfType <PowerUpManager> (); }
// Use this for initialization void Start() { powerUpManager = FindObjectOfType <PowerUpManager>(); powerUpSource = GameObject.Find("PowerUpSound").GetComponent <AudioSource>(); }
/// <summary> /// Called when the object is created. Used to /// initialize the singleton pattern. /// </summary> void Start() { if (Instance == null) { Instance = this; this.Powerups = new Dictionary<string, Powerup>(); this.Multishot = new Powerup(MultiShotTime, MultiBar, this.MultiBarIcon); this.DamageUp = new Powerup(DamageUpTime, DamageUpBar, this.DamageUpBarIcon); this.Shield = new Powerup(ShieldTime, ShieldBar, this.ShieldBarIcon); this.SpeedBoost = new Powerup(SpeedBoostTime, SpeedBar, this.SpeedBarIcon); this.Bomb = new Powerup(0f, null); Powerups.Add("Multishot", this.Multishot); Powerups.Add("DamageUp", this.DamageUp); Powerups.Add("Shield", this.Shield); Powerups.Add("SpeedBoost", this.SpeedBoost); Powerups.Add("Bomb", this.Bomb); SystemLogger.write("Powerup Manager attached to: " + this.gameObject.name); } else { Destroy(this.gameObject); } }
// Start is called before the first frame update void Start() { item = PowerUpManager.Instance; UpdateShop(); }
private void Update() { timer += Time.deltaTime; particlePlayer = FindObjectOfType <ParticlePlayer>(); powerUpManager = FindObjectOfType <PowerUpManager>(); }
// Use this for initialization void Start() { _pum = FindObjectOfType <PowerUpManager>(); }
// Start is called before the first frame update void Start() { gameManager = gameManagerObject.GetComponent <GameManager>(); powerUpManager = powerupManagerObject.GetComponent <PowerUpManager>(); }
// Start is called before the first frame update void Start() { powerupManager = GetComponent <PowerUpManager>(); }
void Awake() { Instance = this; }
//create active selection / floating tower on pressing a tower button public void InstantiateTower(int clickedButton) { //store the TowerManager tower index passed in as parameter index = clickedButton; //we clicked one of these tower buttons //if we already have a floating tower, destroy it and free selections if (SV.selection) { currentGrid = null; currentTower = null; Destroy(SV.selection); } //check if there are free grids left //no free grid left (list count is equal to grid count) if (gridScript.GridList.Count == gridScript.transform.childCount) { //print a warning message StartCoroutine("DisplayError", "No free grids left for placing a new tower!"); Debug.Log("No free grids left for placing a new tower!"); return; } //initialize price array with total count of resources float[] price = new float[GameHandler.resources.Length]; //cache selected upgrade options for further processment UpgOptions opt = towerScript.towerUpgrade[index].options[0]; //loop through resources //get needed resources (buy price) of this tower from upgrade list for (int i = 0; i < price.Length; i++) { price[i] = opt.cost[i]; } //check in case we have not enough resources left, abort purchase for (int i = 0; i < price.Length; i++) { if (GameHandler.resources[i] < price[i]) { StartCoroutine("DisplayError", "Not enough resources for buying this tower!"); Debug.Log("Not enough resources for buying this tower!"); //destroy selection. this is a bit hacky: CancelSelection() destroys all selections, //but we do want to keep our grid selection on BuildMode Grid, thus we cache it right //before calling this method and restore it afterwards if (SV.gridSelection) { GameObject grid = SV.gridSelection; CancelSelection(true); SV.gridSelection = grid; grid.renderer.enabled = true; } else { CancelSelection(true); } return; } } //all checks went through, we are able to purchase this tower //instantiate selected tower from TowerManager prefab list and thus create a floating tower SV.selection = (GameObject)Instantiate(towerScript.towerPrefabs[index], SV.outOfView, Quaternion.identity); SV.selection.name = towerScript.towerNames[index]; //get new base properties of this tower instance towerBase = SV.selection.GetComponentInChildren <TowerBase>(); //change name of the gameobject holding this component to the defined one in TowerManager names list towerBase.gameObject.name = towerScript.towerNames[index]; //parent tower to the container gameobject SV.selection.transform.parent = towerContainer; //get new upgrade properties of this tower instance upgrade = SV.selection.GetComponentInChildren <Upgrade>(); towerBase.upgrade = upgrade; //disable its base properties, so while moving/placing the tower around, it can not attack towerBase.enabled = false; //show all grid renderers to see where we could (or could not) place the tower //but only highlight all of them on BuildMode Tower (where gridSelection is always empty) if (!SV.gridSelection) { gridScript.ToggleVisibility(true); } //apply passive powerups to this tower PowerUpManager.ApplyToSingleTower(towerBase, upgrade); }
public void init() { // deprecated variables warnings: if (jumpForce != 0 && jumpHeight == 0) { Debug.LogError("PlayerController.jumpForce is deprecated. Use jumpHeight instead."); jumpHeight = jumpForce; } if (jumpDownwardForce != 0 && gravity == 0) { Debug.LogError("PlayerController.jumpDownwardForce is deprecated. Use gravity instead."); gravity = jumpDownwardForce; } // rigidbody should no longer use gravity, be kinematic, and freeze all constraints if (rigidbody != null) { if (rigidbody.useGravity) { Debug.LogError("The rigidbody no longer needs to use gravity. Disabling."); rigidbody.useGravity = false; } if (!rigidbody.isKinematic) { Debug.LogError("The rigidbody should be kinematic. Enabling."); rigidbody.isKinematic = true; } if (rigidbody.constraints != RigidbodyConstraints.FreezeAll) { Debug.LogError("The rigidbody should freeze all constraints. The PlayerController will take care of the physics."); rigidbody.constraints = RigidbodyConstraints.FreezeAll; } } cameraController = CameraController.instance; infiniteObjectGenerator = InfiniteObjectGenerator.instance; powerUpManager = PowerUpManager.instance; gameManager = GameManager.instance; if (attackType == AttackType.Projectile) { projectileManager = GetComponent<ProjectileManager>(); } platformLayer = 1 << LayerMask.NameToLayer("Platform"); floorLayer = 1 << LayerMask.NameToLayer("Floor"); wallLayer = LayerMask.NameToLayer("Wall"); obstacleLayer = LayerMask.NameToLayer("Obstacle"); thisTransform = transform; capsuleCollider = GetComponent<CapsuleCollider>(); playerAnimation = GetComponent<PlayerAnimation>(); playerAnimation.init(); startPosition = thisTransform.position; startRotation = thisTransform.rotation; slideData = new CoroutineData(); stumbleData = new CoroutineData(); forwardSpeeds.init(); // determine the fastest and the slowest forward speeds forwardSpeeds.getMinMaxValue(out minForwardSpeed, out maxForwardSpeed); forwardSpeedDelta = maxForwardSpeed - minForwardSpeed; if (forwardSpeedDelta == 0) { playerAnimation.setRunSpeed(1, 1); } // make sure the coin magnet trigger is deactivated activatePowerUp(PowerUpTypes.CoinMagnet, false); reset(); enabled = false; }
public void HookIntoManager(PowerUpManager myManagerRef, string name, int idx) { m_myManager = myManagerRef; this.name = name; m_myManagerIndex = idx; }
void Start() { GameObject gameControllerObject = GameObject.FindWithTag("GameController"); if (gameControllerObject != null) { scoreManager = gameControllerObject.GetComponent<ScoreManager>(); uiManager = gameControllerObject.GetComponent<UIManager>(); powerUpManager = gameControllerObject.GetComponent<PowerUpManager>(); audioManager = gameControllerObject.GetComponent<AudioManager>(); } else { Debug.Log("Cannot find 'GameController' script"); } GameObject playerControllerObject = GameObject.FindWithTag("Player"); if(playerControllerObject != null) { livesManager = playerControllerObject.GetComponent<LivesManager>(); } }
//public bool showTutorial; void Awake() { if (instance == null) instance = this; board = GetComponentInChildren<Board>(); pum = GetComponent<PowerUpManager>(); aimers[0] = transform.FindChild("Aimer1").GetComponent<Aimer>(); aimers[1] = transform.FindChild("Aimer2").GetComponent<Aimer>(); }