/// <summary> /// Shows or hides the active bodypart of the current move to play. /// </summary> /// <param name="show">If set to <c>true</c> show.</param> public void ShowActiveBodypart(bool show) { if (this.moveToPlay == null) { return; //Do nothing if there is no move to play. } Transform bodypart = UnityUtils.RecursiveFind(transform, this.moveToPlay.GetActiveBodypart()); Transform shield = UnityUtils.RecursiveFind(transform, this.moveToPlay.GetActiveBodypart().Replace(" ", "") + "Shield"); if (bodypart != null && bodypart.gameObject.GetComponent <ColorModifier> () != null && !moveToPlay.IsBlockMove()) { //Highlight damage dealer if move is not a block move and show true, hide otherwise. bodypart.gameObject.GetComponent <ColorModifier> ().SetSelected(show); } if (shield != null && moveToPlay.IsBlockMove()) { //Show shield if move is a block move and show true, hide otherwise. shield.gameObject.GetComponent <SpriteRenderer> ().enabled = show; ShieldControl shieldControl = shield.GetComponent <ShieldControl> (); if (shieldControl != null) { shieldControl.UpdateScale(moveToPlay); } } }
public override void Unselect() { if (shieldControl == null) { this.shieldControl = player.transform.Find("Shield").GetComponent <ShieldControl>(); shieldControl.Init(durability, this); } shieldControl.gameObject.SetActive(false); playerControl.ModifySpeed(2.5f); playerControl.ModifyJumpHeight(400); }
public Enterprise Add(Subsystem system) { _systems.Add(system); _commandExecutors[system.Command] = system; if (system is ShieldControl shieldControl) { _shieldControl = shieldControl; } return(this); }
private void UpdateShieldScale() { if (move.IsBlockMove() && GameObject.Find(move.GetActiveBodypart().Replace(" ", "") + "Shield") != null) { GameObject shield = GameObject.Find(move.GetActiveBodypart().Replace(" ", "") + "Shield"); ShieldControl shieldControl = shield.GetComponent <ShieldControl> (); if (shieldControl != null) { shieldControl.UpdateScale(move); } } }
/* ----------------------------------------------------------------------------------------------------------- * UNITY'S STUFF * ----------------------------------------------------------------------------------------------------------- */ /// <summary> /// Will execute when loaded /// </summary> void Awake() { myShieldScript = GetComponent <ShieldControl>(); trLevel = GameObject.Find("Level").transform; if (trLevel == null) { // DEBUG Debug.LogError("Level object not found"); } // Set up the rigidbody rigidbody.isKinematic = true; rigidbody.useGravity = false; }
/// <summary> /// Preset important data and get object references. /// </summary> void Start() { // Store variables for later resets and preset variables. probabilityArray = new float[3]; probabilityArray[0] = asteroid0Chance; probabilityArray[1] = asteroid1Chance; probabilityArray[2] = asteroid2Chance; hazardCountStore = hazardCount; asteroid0ChanceStore = asteroid0Chance; asteroid1ChanceStore = asteroid1Chance; asteroid2ChanceStore = asteroid2Chance; onTargetAsteroidsStore = onTargetAsteroids; targetPosition = targetZone.transform.position; spawnPosition = spawnZone.transform.position; targetArea = targetZone.GetComponent <Renderer>().bounds.size / 2; spawnArea = spawnZone.GetComponent <Renderer>().bounds.size / 2; gameScore = 0; gameState = gameStates.MenuMode; asteroidPoolIdents = new List <int>(); asteroidPool = gameObject.GetComponent <ObjectPool>(); asteroidPoolIdents.Add(asteroidPool.CreateObjectPool(20, asteroidTypes[0].gameObject)); asteroidPoolIdents.Add(asteroidPool.CreateObjectPool(10, asteroidTypes[1].gameObject)); asteroidPoolIdents.Add(asteroidPool.CreateObjectPool(5, asteroidTypes[2].gameObject)); //Get animators mainMenuAnimator = GameObject.Find("Main_Menu").GetComponent <Animator>(); gameUIAnimator = GameObject.Find("Game_UI").GetComponent <Animator>(); //Get controller and other important game object references SC = GameObject.FindGameObjectWithTag("Shield").GetComponent <ShieldControl>(); objectPools = FindObjectsOfType(typeof(ObjectPool)) as ObjectPool[]; playerBuildings = GameObject.FindGameObjectsWithTag("Player"); //Set coroutine identity's asteroidCoroutine = SpawnAsteroids(); menuMissileCoroutine = MenuMissileAutoTarget(); MenuBackGroundGame(); }
// Use this for initialization void Start() { shield = transform.root.GetComponentInChildren <ShieldControl>(); }