public override void TakeAction(AgentHandler agentScript) { GameObject projectileToFire; Projectile projectileScript; switch (agentScript.SelectedWeapon) { case WeaponSelected.MachineGun: projectileToFire = PoolSystem.Instance.GetObjectFromPool(agentScript.BulletPrefab, argShouldExpandPool: true, argShouldCreateNonExistingPool: true); projectileScript = projectileToFire.GetComponent <Projectile>(); projectileScript.SetupProjectile(1.0f, 15.0f, agentScript.transform.position); projectileScript.LaunchProjectile((GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position).normalized, null, false); agentScript.ChangeAgentEnergyBy(-agentScript.GetMachineGunEnergyCost()); break; case WeaponSelected.RocketLauncher: projectileToFire = PoolSystem.Instance.GetObjectFromPool(agentScript.BulletPrefab, argShouldExpandPool: true, argShouldCreateNonExistingPool: true); projectileScript = projectileToFire.GetComponent <Projectile>(); projectileScript.SetupProjectile(1.0f, 15.0f, agentScript.transform.position); projectileScript.LaunchProjectile((GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position).normalized, GameConstants.Instance.PlayerObject, true); agentScript.ChangeAgentEnergyBy(-agentScript.GetRocketLauncherEnergyCost()); break; default: break; } agentScript.SetFireProjectileTimer(0.0f); }
public void RunChildDecision(AgentHandler agentInformation, bool value) { if (value) { if (TrueNode != null) { TrueNode.MakeDecision(agentInformation); return; } else if (TrueAction != null) { TrueAction.TakeAction(agentInformation); return; } } else { if (FalseNode != null) { FalseNode.MakeDecision(agentInformation); return; } else if (FalseAction != null) { FalseAction.TakeAction(agentInformation); return; } } //Debug.Log("No Further Decisions Or Actions!"); }
public override void Act(GameObject player, AgentHandler agent) { agent.mState = "Path"; float distanceThresholdSqrd = 25f; //Follow the Found Path if (mCondensedPath != null && mCondensedPath.Count > 0) { if (Vector3.SqrMagnitude(agent.transform.position - agent.BoidController.GetTarget()) < distanceThresholdSqrd) { int furthestVisisbleIndex = PathHelpers.FindFurthestVisiblePointIndex(mCondensedPath, agent.transform.position, LayerMask.GetMask("Default")); agent.BoidController.SetTarget(mCondensedPath[furthestVisisbleIndex]); if (Vector3.Angle(agent.transform.forward, (mCondensedPath[furthestVisisbleIndex] - agent.transform.position)) > 30) { agent.transform.forward = (mCondensedPath[furthestVisisbleIndex] - agent.transform.position); } } if (Vector3.SqrMagnitude(agent.transform.position - mCondensedPath[mCondensedPath.Count - 1]) < distanceThresholdSqrd) { agent.BoidController.SetTarget(player.transform.position); CalculateNewPath(); } } agent.BoidController.SetShouldFlock(true); // Find paths for boids using spatial grid // give boids some mechanic that allows them to follow a path (Setting target to furthest visible point?) // state machine handles the rest.. }
public override void Act(GameObject player, AgentHandler agent) { agent.mState = "Chase"; //Chase Player //agent.BoidController.SetTarget(player.transform.position); //agent.BoidController.SetShouldFlock(true); }
public void SpawnEnemyDrone(Vector3 positionToSpawn) { GameObject enemyObject = PoolSystem.Instance.GetObjectFromPool(mEnemyDrone, argShouldExpandPool: true, argShouldCreateNonExistingPool: true); AgentHandler agentHandler = enemyObject.GetComponent <AgentHandler>(); agentHandler.SetupAgentForSpawning(Mathf.Clamp(mCurrentWave, 0, 3), 20.0f, positionToSpawn); agentHandler.SpawnAgent(); }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.GetEnergy() > 10) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void TakeAction(AgentHandler agentScript) { GameConstants.Instance.NumberOfMines++; GameObject mineToDeploy = PoolSystem.Instance.GetObjectFromPool(agentScript.MinePrefab, argActivateObject: true, argShouldExpandPool: true, argShouldCreateNonExistingPool: true); Mine mineScript = mineToDeploy.GetComponent <Mine>(); mineScript.SpawnMine(agentScript.transform.position); agentScript.SetDeployMineTimer(0.0f); }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.GetEnergy() >= agentScript.GetRocketLauncherEnergyCost()) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.GetDeployMineTimer() >= agentScript.GetTimeRequiredToDelopMine() && GameConstants.Instance.NumberOfMines < GameConstants.Instance.MaxNumberOfMines) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.SelectedWeapon == WeaponSelected.RocketLauncher && agentScript.GetFireprojectileTimer() >= agentScript.RocketLauncherFireRate) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.GetEnergyRegenTimer() >= agentScript.TimeToRegenEnergy) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void TakeAction(AgentHandler agentScript) { float distanceToPlayer = (GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position).magnitude; distanceToPlayer = Mathf.Clamp(distanceToPlayer, 0, 100); distanceToPlayer *= 0.01f; float mSeekWeight = distanceToPlayer * 1f; agentScript.BoidController.SetTarget(GameConstants.Instance.PlayerObject.transform.position); agentScript.BoidController.SeekPoint(GameConstants.Instance.PlayerObject.transform.position, mSeekWeight); agentScript.BoidController.SetShouldFlock(true); }
public override void TakeAction(AgentHandler agentScript) { GameObject projectileToFire = PoolSystem.Instance.GetObjectFromPool(agentScript.RocketPrefab, argShouldExpandPool: true, argShouldCreateNonExistingPool: true); Projectile projectileScript = projectileToFire.GetComponent <Projectile>(); projectileScript.SetupProjectile(5.0f, 12.0f, agentScript.transform.position); projectileScript.LaunchProjectile((GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position).normalized, GameConstants.Instance.PlayerObject, true); agentScript.ChangeAgentEnergyBy(-agentScript.GetRocketLauncherEnergyCost()); agentScript.SetFireProjectileTimer(0.0f); }
public override void MakeDecision(AgentHandler agentScript) { Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position; if (directionToPlayer.magnitude >= agentScript.GetTargetTooCloseRange() && directionToPlayer.magnitude <= agentScript.GetAttackRange()) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { float requiredEnergy = (agentScript.SelectedWeapon == WeaponSelected.MachineGun) ? agentScript.GetMachineGunEnergyCost() : agentScript.GetRocketLauncherEnergyCost(); if (agentScript.GetEnergy() >= requiredEnergy) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { float requiredTime = (agentScript.SelectedWeapon == WeaponSelected.MachineGun) ? agentScript.MachineGunFireRate : agentScript.RocketLauncherFireRate; if (agentScript.GetFireprojectileTimer() >= requiredTime) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void MakeDecision(AgentHandler agentScript) { Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position; if (!Physics.Raycast(agentScript.transform.position, directionToPlayer.normalized, directionToPlayer.magnitude, LayerMask.GetMask("Default"))) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
public override void Reason(GameObject player, AgentHandler agent) { Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agent.transform.position; if (!Physics.Raycast(agent.transform.position, directionToPlayer.normalized, directionToPlayer.magnitude, LayerMask.GetMask("Default"))) { if (directionToPlayer.magnitude <= agent.GetAttackRange()) { agent.FSMTransitionPassthrough(fsmTransition.ToAttack); } else { agent.FSMTransitionPassthrough(fsmTransition.ToChase); } } }
public override void MakeDecision(AgentHandler agentScript) { if (agentScript.GetEnergyRegenTimer() >= agentScript.TimeToRegenEnergy) { agentScript.ChangeAgentEnergyBy(1); agentScript.SetEnergyRegenTimer(0.0f); } Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agentScript.transform.position; if (directionToPlayer.magnitude <= agentScript.GetAttackRange()) { RunChildDecision(agentScript, true); } else { RunChildDecision(agentScript, false); } }
/// <summary> /// Internal use, the Bot will initialize the script with its input handlers once its loaded into memory /// </summary> /// <param name="bot">The reference to the bot's windowhandler</param> public void initializeInputs(WindowHandler bot) { this.EMouse = bot.MOUSE; this.EPreciseMouse = bot.PMOUSE; this.EMenuHandler = bot.MENU; this.ECommunicator = bot.COMMUNICATOR; this.EOverViewHandler = bot.OVERVIEW; this.EStationHandler = bot.STATION; this.MyShip = bot.SHIP; this.ESession = bot.SESSION; this.ECamera = bot.CAMERA; this.EKeyboard = bot.KEYBOARD; this.ELocalHandler = bot.LOCAL; this.EDrawingArea = bot.DrawingArea; this.ELogger = bot.LOGGER; this.ELogger.ScriptName = name; this.EAgentHandler = bot.AGENT; ERandom = new Random(); }
public override void Act(GameObject player, AgentHandler agent) { agent.mState = "Attack"; //Attack the Player agent.BoidController.SetTarget(player.transform.position); agent.BoidController.SetShouldFlock(false); float range = agent.GetTargetTooCloseRange(); if ((range * range) > (player.transform.position - agent.transform.position).sqrMagnitude) { agent.BoidController.FleePoint(player.transform.position, 5f); } EditableTree BasicAgentAttackTree = agent.GetBasicAgentDecisionTree(); if (BasicAgentAttackTree != null) { BasicAgentAttackTree.mRoot.MakeDecision(agent); } }
public override void Reason(GameObject player, AgentHandler agent) { Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agent.transform.position; if (Physics.Raycast(agent.transform.position, directionToPlayer.normalized, directionToPlayer.magnitude, LayerMask.GetMask("Default"))) { agent.FSMTransitionPassthrough(fsmTransition.ToLostPlayer); } else { EditableTree SwitchToAttackDecisionTree = agent.GetSwitchToAttackDecisionTree(); if (SwitchToAttackDecisionTree != null) { SwitchToAttackDecisionTree.mRoot.MakeDecision(agent); } //if (directionToPlayer.magnitude <= agent.GetAttackRange()) //agent.FSMTransitionPassthrough(fsmTransition.ToAttack); } }
public override void TakeAction(AgentHandler agentScript) { agentScript.SelectedWeapon = WeaponSelected.MachineGun; }
public override void TakeAction(AgentHandler agentScript) { agentScript.SelectedWeapon = WeaponSelected.RocketLauncher; }
public abstract void Reason(GameObject player, AgentHandler agent);
public virtual void TakeAction(AgentHandler agentInformation) { }
public abstract void Act(GameObject player, AgentHandler agent);
public virtual void MakeDecision(AgentHandler agentInformation) { }
public override void TakeAction(AgentHandler agentScript) { agentScript.FSMTransitionPassthrough(fsmTransition.ToAttack); }
public override void TakeAction(AgentHandler agentScript) { agentScript.ChangeAgentEnergyBy(1); agentScript.SetEnergyRegenTimer(0.0f); }