} // Used by AI to turn shield on or off private void Start() { AOScript = gameObject.GetComponent <AudioOcclusion>(); if (!gameObject.CompareTag("Non-playables")) { startingHP = mech.health; currentHP = startingHP; normalShieldLevels = mech.defense; shields = mech.defense; shieldsChargesLeft = mech.shieldCharges; scoreHandler = GetComponent <ScoreHandler>(); isUsingShield = false; ShouldUseShield(false); } respawnManager = GameObject.Find("SpawnManager").GetComponent <SpawnParticipantIfAble>(); if (gameObject.CompareTag("Player")) { setVcamScript = GetComponent <SetVcamFollowAndLookAt>(); playerCamNoise = setVcamScript._vcam.GetComponent <PlayerCamNoise>(); } if (GetComponent <DoubleStatsSpecial>() != null) { doubleStats = GetComponent <DoubleStatsSpecial>(); } }
public override void OnStateEnter() { //Debug.Log("Entered Patrol state"); thisAgent = agent.GetComponent <NavMeshAgent>(); agentHealth = agent.GetComponent <Health>(); shootingScript = agent.GetComponent <EnemyShooting>(); doubleStats = agent.GetComponent <DoubleStatsSpecial>(); if (doubleStats != null && doubleStats._areStatsBuffed) { defaultAiSpeed = agent._mech.fowardMoveSpeed * 2; } else { defaultAiSpeed = agent._mech.fowardMoveSpeed; } thisAgent.SetDestination(agent.transform.position); agentHealth._myAttacker = null; agent.getValidTargets.Clear(); timerCount = patrolTimer; }
public override void OnStateEnter() { //Debug.Log("Entered Chase state"); thisAgent = agent.GetComponent <NavMeshAgent>(); shootingScript = agent.GetComponent <EnemyShooting>(); thisAgentHealth = agent.GetComponent <Health>(); doubleStats = agent.GetComponent <DoubleStatsSpecial>(); if (doubleStats != null && doubleStats._areStatsBuffed) { dashSpeed = agent._mech.dashSpeed * 2; dashTimeLimit = agent._mech.dashTimeLimit * 2; defaultAiSpeed = agent._mech.fowardMoveSpeed * 2; } else { dashSpeed = agent._mech.dashSpeed; dashTimeLimit = agent._mech.dashTimeLimit; defaultAiSpeed = agent._mech.fowardMoveSpeed; } minRangeBeforeDashAllowed = agent._mech.range / 2; maxStoppingDist = agent._mech.range - 20f; thisAgent.SetDestination(agent.transform.position); }
protected override void Start() { //Calls start function of Shooting script base.Start(); damage = mech.damage; range = mech.range; fireRate = mech.fireRate; breakContactAtThisRange = range; doubleStats = GetComponent <DoubleStatsSpecial>(); health = GetComponent <Health>(); ammo = GetComponent <AmmoHandling>(); scoreHandler = health._scoreHandler; }
protected override void Start() { base.Start(); damage = mecha.damage; range = mecha.range; fireRate = mecha.fireRate; bulletPool = transform.Find("PlayerBulletPool"); health = GetComponent <Health>(); ammo = GetComponent <AmmoHandling>(); scoreHandler = health._scoreHandler; if (GetComponent <DoubleStatsSpecial>() != null) { doubleStats = GetComponent <DoubleStatsSpecial>(); } }
private void Start() { fowardMoveSpeed = mech.fowardMoveSpeed; turnSpeed = mech.turnSpeed; backwardMoveSpeed = mech.backwardMoveSpeed; strafingLeftMoveSpeed = mech.strafingLeftMoveSpeed; strafingRightMoveSpeed = mech.strafingRightMoveSpeed; dashSpeed = mech.dashSpeed; dashTimeLimit = mech.dashTimeLimit; PPV = GameObject.FindGameObjectWithTag("PostProcessing"); PPV.SetActive(false); playerEventsScript = gameObject.GetComponent <PlayerFMODEvents>(); if (GetComponent <DoubleStatsSpecial>() != null) { doubleStats = GetComponent <DoubleStatsSpecial>(); } }
public override void OnStateEnter() { //Debug.Log(agent.gameObject.name + " is entered Retreat State"); navAgent = agent.GetComponent <NavMeshAgent>(); thisAgentShootingScript = agent.GetComponent <EnemyShooting>(); health = agent.GetComponent <Health>(); doubleStats = agent.GetComponent <DoubleStatsSpecial>(); if (doubleStats != null && doubleStats._areStatsBuffed) { defaultAiSpeed = agent._mech.fowardMoveSpeed * 2; } else { defaultAiSpeed = agent._mech.fowardMoveSpeed; } navAgent.SetDestination(agent.transform.position); mech = agent._mech; enemyPos = health._myAttacker; if (enemyPos != null) { if (enemyPos.CompareTag("Player")) { playerShooting = enemyPos.GetComponent <PlayerShooting>(); minDistanceFromEnemyPos = playerShooting._playerShootingRange; } else if (enemyPos.CompareTag("Enemy") && !enemyPos.CompareTag("Non-playables")) { aiAttackerShootingScript = enemyPos.GetComponent <EnemyShooting>(); minDistanceFromEnemyPos = aiAttackerShootingScript.getBreakContactRange; } else { Debug.LogError(agent.gameObject.name + "'s " + "attacker is null or unknown!"); } } }