public void DistAttackToTile(Tile tile) { StatsScript stats = gameObject.GetComponent <StatsScript>(); if (tile.npc != null && tile.npc != gameObject) { if (stats.stamina >= distAttackCost) { stats.UseStamina(distAttackCost); tile.target = true; attacking = true; stack.Clear(); stack.Push(tile); } else { return; } } else { tile.failAttack = true; } }
// Start is called before the first frame update void Start() { gameData = GameObject.Find("GameData").GetComponent <GameData>(); stats = GameObject.Find("StatsObject").GetComponent <StatsScript>(); string txt = ""; foreach (PlayerStats stat in stats.playerStats) { txt += "P" + stat.playerNumber + " got " + stat.kills + " and died " + stat.deaths + " times\n"; } playerStatsText.text = txt; if (gameData.winner == GameWinner.HORDE) { Debug.Log("Sushi won"); background.GetComponent <Image>().sprite = hordeWinBG; } else { Debug.Log("Chefs won"); background.GetComponent <Image>().sprite = chefsWinBG; } }
public void Awake() { storedObjects = new GameObject[maxStorage]; carrier = GetComponent <Carrier>(); statsScript = GetComponent <StatsScript>(); eventManager = GameObject.FindWithTag("Event Manager").GetComponent <EventManager>(); }
// Use this for initialization void Start() { v3 = this.gameObject.transform.position; ss = this.gameObject.GetComponent <StatsScript>(); me = this.gameObject.GetComponent <EnemyScript>(); rb = this.gameObject.GetComponent <Rigidbody2D>(); }
// Use this for initialization void Start() { posInicial = transform.position; int r = UnityEngine.Random.Range(0, 2); r = r == 0 ? -1 : 1; transform.localScale = new Vector3(r, 1, 1); // rb = this.gameObject.GetComponent <Rigidbody2D>(); //recalcular os stats pelo level ss = this.gameObject.GetComponent <StatsScript>(); ss.poder *= (int)(level * multiplicadorLVL); ss.armadura *= (int)(level * multiplicadorLVL); ss.vida *= (int)(level * multiplicadorLVL); ss.cadencia *= (int)(level * multiplicadorLVL); ss.velocidade = (int)(ss.velocidade * (level * (multiplicadorLVL * 0.1))); ss.souls *= (int)(level * multiplicadorLVL); ss.poder = ss.poder <= 0 ? 1:ss.poder; ss.armadura = ss.armadura <= 0 ? 1 : ss.armadura; ss.vida = ss.vida <= 0 ? 1 : ss.vida; ss.maxVida = ss.vida; ss.cadencia = ss.cadencia <= 0 ? 1 : ss.cadencia; ss.velocidade = ss.velocidade <= 0 ? 1 : ss.velocidade; ss.souls = ss.souls <= 0 ? 1 : ss.souls; }
/// <summary> /// Hard speed of 20 /// Pitcher Areitta J /// </summary> void ChangespeedH() { //sets stats equal to Arietta J's stats and sets the pitch and quadrent equal to a new random one stats = GameObject.Find("CSV").GetComponent <StatsScript>() as StatsScript; Paths = stats.getPitchType(); quadrent = stats.setQuadrent(); speed = 20; }
/// <summary> /// Includes finding game objects, setting references and changing background music /// [EXTENSION] - Log the player initally being sent into battle /// - Create an original copy of all the player stats to be restored to revert stat changes /// </summary> void Start() { //Find Objects attacksPanel = GameObject.Find("BattleCanvas").transform.Find("AttacksPanel").gameObject; playerStats = GameObject.Find("PlayerStats"); enemyStats = GameObject.Find("EnemyStats"); attackButton = GameObject.Find("AttackButton").GetComponent <Button> (); playerButton = GameObject.Find("PlayersButton").GetComponent <Button> (); runButton = GameObject.Find("RunButton").GetComponent <Button> (); setButtonsInteractable(true); textBox = GameObject.Find("TextBox").transform.Find("Text").GetComponent <Text> (); playerSprite = GameObject.Find("PlayerImage").GetComponent <Image> (); enemySprite = GameObject.Find("EnemyImage").GetComponent <Image> (); //Setup Object references playerArray = PlayerData.instance.data.Players; enemyObject = GlobalFunctions.instance.getEnemy(); moneyReward = GlobalFunctions.instance.getMoney(); itemReward = GlobalFunctions.instance.getItem(); //create a copy of player stats before battle originalCopy = createOriginalCopy(playerArray); manager = new BattleManager(playerArray[0], enemyObject, moneyReward); player = manager.Player; enemy = manager.Enemy; Texture2D image; image = enemy.Image; enemySprite.sprite = Sprite.Create(image, new Rect(0.0f, 0.0f, image.width, image.height), new Vector2(0.5f, 0.5f)); image = player.Image; playerSprite.sprite = Sprite.Create(image, new Rect(0.0f, 0.0f, image.width, image.height), new Vector2(0.5f, 0.5f)); //Log player being used QManagerObj.manager.logQuestVariable(questTypes.onlyOneCharacter, player.Name); //setup references and inital displays of all bars expBar = playerStats.transform.Find("Exp").GetComponent <StatsScript> (); playerHealthBar = playerStats.transform.Find("Health").GetComponent <StatsScript> (); playerMagicBar = playerStats.transform.Find("Magic").GetComponent <StatsScript> (); enemyHealthBar = enemyStats.transform.Find("Health").GetComponent <StatsScript> (); enemyMagicBar = enemyStats.transform.Find("Magic").GetComponent <StatsScript> (); expBar.setUpDisplay(player.Exp, player.ExpToNextLevel); playerHealthBar.setUpDisplay(player.Health, 100); enemyHealthBar.setUpDisplay(enemy.Health, 100); playerMagicBar.setUpDisplay(player.Magic, player.MaximumMagic); enemyMagicBar.setUpDisplay(enemy.Magic, enemy.MaximumMagic); //Setup local variables moveChosen = false; playerDied = false; //Change Music BGM = Resources.Load("Audio/battle", typeof(AudioClip)) as AudioClip; SoundManager.instance.playBGM(BGM); victory = Resources.Load("Audio/victory", typeof(AudioClip)) as AudioClip; }
// private CharacterSelection PlayersChoice; // Use this for initialization void Start() { chara = GameObject.FindGameObjectWithTag("Player"); cam = Camera.main.transform; lastPos = transform.position; SlopeScr = chara.GetComponent <SlopesScript>(); anim = GetComponent <Animator>(); inventory.ItemUsed += Inventory_ItemUsed; PlayerStats = chara.GetComponent <StatsScript>(); }
public int reservaTotal() { int valor = 0; foreach (GameObject go in reservas) { StatsScript ss = go.GetComponent <StatsScript>(); valor += ss.souls; } return(valor); }
// Use this for initialization void Start() { gm = GetComponentInParent <GameManager>(); stats = gm.getPlayer().GetComponent <StatsScript>(); healthSlider = gameObject.transform.Find("HealthSlider").GetComponent <Slider>(); manaSlider = gameObject.transform.Find("ManaSlider").GetComponent <Slider>(); xpSlider = gameObject.transform.Find("XpSlider").GetComponent <Slider>(); healthSlider.maxValue = stats.getMaxHealth(); manaSlider.maxValue = stats.getMaxMana(); xpSlider.maxValue = stats.getMaxExp(); }
void Start() { audio = GameObject.Find("Sounds").GetComponents <AudioSource>()[1]; currentHP = maxHP; turnEnded = false; alive = true; checkCollision = false; navAgent = GetComponent <NavMeshAgent>(); speed = navAgent.speed; //set speed to default speed of nav agent turnManager = GameObject.Find("GameRoundManager").GetComponent <TurnManager>(); cameraManager = turnManager.GetComponent <CameraManager>(); graveyard = GameObject.Find("Graveyard").GetComponent <EnemyGraveyard>(); stats = GameObject.Find("Stats").GetComponent <StatsScript>(); }
public void StartWave() { //print(waveName); StatsScript building = GameObject.Find("buildingCenter").GetComponent <StatsScript>(); building.Repair(); AttachWeaponScript[] aws = GameObject.Find("Buildings").GetComponentsInChildren <AttachWeaponScript>(); for (int i = 0; i != aws.Length; ++i) { aws[i].ResetCooldown(); } workerLeft = workerCount; blondeLeft = blondeCount; sailorLeft = sailorCount; }
public void MoveToTile(Tile tile) { //Here we calculate how much stamina use StatsScript stats = gameObject.GetComponent <StatsScript>(); int wasted = tile.dist; //////////Case to Enemy if (gameObject.tag == "Enemy") { if (stats.stamina - move >= 0) { wasted = move; } else if (stats.stamina - move > -move) { move = (int)stats.stamina; NPCActionScript npcAction = gameObject.GetComponent <NPCActionScript>(); npcAction.FindNearestTarget(); npcAction.CalculatePath(); wasted = (int)stats.stamina; move = maxMoveAI; return; } else { wasted = -1; } } ///////////////// if (stats.stamina >= wasted && wasted != -1) { stats.UseStamina(wasted); tile.target = true; moving = true; stack.Clear(); Tile next = tile; while (next != null) { stack.Push(next); next = next.parent; } } }
// Use this for initialization /// <summary> /// Get everything from the stats list and use them /// </summary> void Start() { s = new StatsScript(); index = new string[13]; index[0] = "Arrieta, J."; for (int i = 1; i < 13; i++) { index[i] = i.ToString(); } pitch = getPitchType(); Debug.Log(pitch); qaudrent = setQuadrent(); }
internal void reservaSubSouls(int value) { foreach (GameObject go in reservas) { StatsScript ss = go.GetComponent <StatsScript>(); if (ss.souls >= value) { ss.souls -= value; value -= value; } else if (ss.souls > 0) { value -= ss.souls; ss.souls -= ss.souls; } go.GetComponent <ReservaScript>().reposicionar(ss.souls, ss.maxSouls); } }
void Start() { gameData = GameObject.Find("GameData").GetComponent <GameData>(); statsScript = GameObject.Find("StatsObject").GetComponent <StatsScript>(); // This will only find the currently active spawn points playerSpawnPoints = new List <GameObject>(GameObject.FindGameObjectsWithTag("Player spawnpoint")); GameObject selectiomDataObj = GameObject.Find("PlayerSelectionData"); if (selectiomDataObj != null) { playerSelectionData = selectiomDataObj.GetComponent <PlayerSelectionData>(); SpawnPlayers(); } else { SpawnPlayersForKeyboardAndMouseControl(); } }
void OnTriggerStay2D(Collider2D collider) { try { StatsScript ss = collider.gameObject.GetComponent <StatsScript>(); if (ss.souls < ss.maxSouls && ss.vivo) { if (collider.tag == "Player") { ss.AddSouls(pontos); if (ss.souls > ss.maxSouls) { ss.souls = ss.maxSouls; } Destroy(this.gameObject); } } }catch (UnityException ue) { //não faz nada } }
void Start() { AudioSource[] sources = GameObject.Find("Sounds").GetComponents <AudioSource>(); walkingAudio = sources[1]; fightingAudio = sources[2]; navAgent = GetComponent <NavMeshAgent>(); speed = navAgent.speed; //set speed to default speed of nav agent selected = false; selector = manager.GetComponent <PlayerSelector>(); turnManager = GameObject.Find("GameRoundManager").GetComponent <TurnManager>(); cameraManager = turnManager.GetComponent <CameraManager>(); defaultMaterial = GetComponent <Renderer>().material; turnEnded = false; checkCollision = false; graveyard = GameObject.Find("Graveyard").GetComponent <PlayerGraveyard>(); stats = GameObject.Find("Stats").GetComponent <StatsScript>(); currentHP = maxHP; }
void OnTriggerEnter2D(Collider2D collision) { if (doNothing(collision.gameObject.tag)) { return; } try { StatsScript ss = collision.gameObject.GetComponent <StatsScript>(); if (ss == null || !ss.vivo) { return; } if (ss != null) { ss.Damage(poder); } }catch (UnityException ue) { // } splash(); }
// Use this for initialization void Start() { souls = 0; if (mainScoreDisplay) { mainScoreDisplay.text = "0"; } if (gm == null) { gm = this.gameObject.GetComponent <GameManagerScript>(); } if (healthBar != null) { healthBarSize = healthBar.rectTransform.rect.width; } else { healthBarSize = 92f; } ss = player.GetComponent <StatsScript>(); }
// Use this for initialization void Start() { statScript = gameObject.GetComponent<StatsScript>(); bSSPscript = GameObject.Find ("BattleSkillsCanvas").GetComponent<BattleSkillSelectPanelScript>(); bSSPscript.Fade (); knightBattleSkillScript = GameObject.Find ("KnightBattleSkillsCanvas").GetComponent<BattleSkillSelectPanelScript>(); knightBattleSkillScript.Fade (); mBMscript = GameObject.Find ("MainBattleMenuCanvas").GetComponent<MainBattleMenuScript>(); mBMscript.Fade (); mSSMscript = GameObject.Find ("MagicSkillMenuCanvas").GetComponent<MagicSkillSelectMenuScript>(); mSSMscript.Fade (); techScript = GameObject.Find ("SwordTechniqueMenuCanvas").GetComponent<MagicSkillSelectMenuScript>(); techScript.Fade (); cScript = mainCamera.GetComponent<CameraScript>(); musicPlayed = false; hero = new List<PlayerScript>(); enemy = new List<EnemyScript>(); if (Application.loadedLevelName == "GrasslandsBattle") { PlayerScript playerSc1 = (PlayerScript) GameObject.Find("Zebulon (Clone)").GetComponent<PlayerScript>(); EnemyScript enemySc1 = (EnemyScript) GameObject.Find("Green Spider").GetComponent<EnemyScript>(); PlayerScript playerSc2 = (PlayerScript) GameObject.Find("Zebulon").GetComponent<PlayerScript>(); EnemyScript enemySc2 = (EnemyScript) GameObject.Find("Dark Troll").GetComponent<EnemyScript>(); //PlayerScript playerSc3 = (PlayerScript) GameObject.Find("Dalton").GetComponent<PlayerScript>(); hero.Add(playerSc1); hero.Add (playerSc2); //hero.Add (playerSc3); enemy.Add(enemySc1); enemy.Add (enemySc2); } else if (Application.loadedLevelName == "snowScene") { PlayerScript playerSc1 = (PlayerScript) GameObject.Find("Zebulon (Clone)").GetComponent<PlayerScript>(); PlayerScript playerSc2 = (PlayerScript) GameObject.Find("Zebulon").GetComponent<PlayerScript>(); EnemyScript enemySc1 = (EnemyScript) GameObject.Find("skeletonMage").GetComponent<EnemyScript>(); EnemyScript enemySc2 = (EnemyScript) GameObject.Find("skeletonSpearman").GetComponent<EnemyScript>(); hero.Add(playerSc1); hero.Add (playerSc2); enemy.Add (enemySc1); enemy.Add (enemySc2); } state = "PlayerSelect"; //Change the length of options later to accommodate more menu options options = new string[1]; options[0] = "Attack"; //Add more menu options here later as string elements of the options array pointerIndex = 0; //current menu option to point at attackOrder = new Queue<GameObject>(); selectCircle = GameObject.Find ("SelectionCircle").GetComponent<CircleActivationScript>(); selectCircle.Fade (); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player"); PlayerStats = player.GetComponent <StatsScript>(); PlayerCol = player.GetComponent <Collider>(); }
// Use this for initialization void Awake() { stats = new StatsScript(); coinsText.text = stats.coins.ToString(); currentWaveText.text = waveController.currentWave.ToString(); }
// Use this for initialization void Start() { ss = this.gameObject.GetComponent <StatsScript>(); }
// Update is called once per frame void Update() { if (!checkHealth() && gameObject.activeSelf == true) { int stamina = gameObject.GetComponent <StatsScript> ().stamina; if (stamina <= 0.0 && moving == false && attacking == false && turn) { moving = false; distAttack = false; attacking = false; meleAttack = false; this.GetComponent <StatsScript> ().ResetStamina(); TurnManager.EndTurn(); } if (turn) { if (moving || attacking) { if (moving) { Move(); } else if (attacking) { if (distAttack) { DistAttack(); } else if (meleAttack) { MeleAttack(); } } } else { if (distAttack == false) { FindNearestTarget(); FindDistAttackTile(); Tile TargetTile = GetTargetTile(target); if (TargetTile.attack && stamina >= distAttackCost && meleAttack == false) { DistAttackToTile(TargetTile); distAttack = true; } } if (distAttack == false) { FindAttackTile(); Tile TargetTile = GetTargetTile(target); if (TargetTile.attack && stamina >= meleAttackCost) { MeleAttackToTile(TargetTile); meleAttack = true; } } if (!moving && distAttack == false && meleAttack == false) { CalculatePath(); FindGoTile(); if (actualTargetTile != null) { actualTargetTile.target = true; } else { this.GetComponent <StatsScript> ().ResetStamina(); moving = false; distAttack = false; attacking = false; meleAttack = false; RemoveSelectableTiles(); TurnManager.EndTurn(); } } } StatsScript stats = gameObject.GetComponent <StatsScript> (); if (lastMove == true && moving == false) { lastMove = false; } } } else { if (gameObject.activeSelf == false) { currentTile.Restart(gameObject, true); } } }
// Use this for initialization void Start() { state = "parado"; ss = this.gameObject.GetComponent <StatsScript>(); }
// Use this for initialization void Start() { iniPosSoulsBar = soulsFluid.transform.localPosition.y; ss = this.gameObject.GetComponent <StatsScript>(); }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); pm = this.gameObject.GetComponent <PlayerMovement>(); ss = this.gameObject.GetComponent <StatsScript>(); }