public void CmdIncreaseEnemyDamage(int increasedAmount, int skillCost) { playerSkill.decreaseBar(skillCost); enemy = GameObject.FindGameObjectsWithTag("Enemy"); for (int i = 0; i < enemy.Length; i++) { float yPositionOffset = enemy[i].transform.position.y - gameObject.transform.position.y; if (yPositionOffset > 1 || yPositionOffset < -1) //We heal the enemy on the opposition bridge { enemyAttack = enemy[i].GetComponent <EnemyAttackMult>(); enemyAttack.attackDamage += increasedAmount; } } Debug.Log("Enemy Attack Increased"); }
void Awake() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); //get all the players on the scene //Get the player that the enemy will track //It will track the player that is standing on the same 'bridge' for (int i = 0; i < 2; i++) { float playerLocationOffset = gameObject.transform.position.y - players[i].transform.position.y; if ((playerLocationOffset < Center) && (playerLocationOffset > -(Center))) { playerSkill = players[i].GetComponent <PlayerSkillMult>(); playerScore = players[i].GetComponent <PlayerScore>(); } } anim = GetComponent <Animator> (); currentHealth = startingHealth; enemyMovement = GetComponent <EnemyMovementMult> (); enemyAttack = GetComponent <EnemyAttackMult> (); }