public Transform SpawnAI(Vector3 position, Transform aiPrefab, AISettings settings, Image compassPre) { nextSpawn++; ai = Instantiate(aiPrefab); ai.position = position; AIController ctrl = ai.GetComponent <AIController>(); ctrl.OnAiDied.AddListener(t => AIDied(t)); ctrl.SetupAI(settings); Image healthbar = (Image)GameObject.Instantiate(healthBarPrefab); healthbar.rectTransform.SetParent(healthui); healthbar.rectTransform.localScale = new Vector3(1, 1, 1); healthbar.GetComponent <HealthBar>().canvasRectT = healthui; healthbar.GetComponent <HealthBar>().objectToFollow = ai; Image compass = (Image)GameObject.Instantiate(compassPre); compass.rectTransform.SetParent(healthui); compass.rectTransform.localScale = new Vector3(1, 1, 1); compass.GetComponent <Compass>().canvasRectT = healthui; compass.GetComponent <Compass>().objectToFollow = ai; if (aiCam != null) { aiCam.SwitchFocusTo(ai.gameObject); } actualAIs.Add(ai); player.Target = actualAIs[0]; player.SetupAI(playerAiSettingsEnemy); return(ai); }
void Start() { playerAiSettingsFlagg = new AISettings(AIController.AIType.DEFENSIVE) { isPlayerAi = true, Accuracy = 100, CoolDown = 0.25f, MaxAreaWidth = 5, MaxExtraCooldown = 0, MaxLP = 10, MinDistance = 0, ShootDistance = 0 }; playerAiSettingsEnemy = new AISettings(AIController.AIType.DEFENSIVE) { isPlayerAi = true, Accuracy = 100, CoolDown = 0.25f, MaxAreaWidth = 5, MaxExtraCooldown = 0, MaxLP = 10, MinDistance = 40, ShootDistance = 60 }; player.SetupAI(playerAiSettingsFlagg); flagg = player.target; }
// Use this for initialization void Start() { def = GameSettingsController.Instance.CurrentSettings.Def; agg = GameSettingsController.Instance.CurrentSettings.Agg; defAI = SpawnAI(defSpawn.position, defPrefab, def); aggAI = SpawnAI(aggSpawn.position, aggPrefab, agg); defAI.GetComponent <AIController>().Target = aggAI; }
/// <summary> /// Copies the settings from the given AISettings instance into this instance /// </summary> public void Set(AISettings other) { // Copy the settings of the given instance attackRate = other.attackRate; attackRateFluctuation = other.attackRateFluctuation; battleCircleRadius = other.battleCircleRadius; simultaneousAttackers = other.simultaneousAttackers; }
public AIWait(ref AISettings settings, Transform transform, ref UnityEngine.AI.NavMeshAgent navAgent) : base(ref settings, transform, ref navAgent) { aiS = settings; t = transform; nav = navAgent; nav.SetDestination(t.position); lastKnown = t.position; }
public AIPlayer(Board board, AISettings settings) { this.settings = settings; this.board = board; settings.requestAbortSearch += TimeOutThreadedSearch; search = new Search(board, settings); search.onSearchComplete += OnSearchComplete; search.searchDiagnostics = new Search.SearchDiagnostics(); book = BookCreator.LoadBookFromFile(settings.book); }
public void LoadRankedSettings() { def = new AISettings(AIController.AIType.DEFENSIVE); agg = new AISettings(AIController.AIType.AGGRESSIVE); playerHP = 20; medPacksAllowed = true; flagCompass = true; enemyCompass = true; maxAICount = 2; medPackHealAmount = 5; medPackRndHealAmount = 3; }
public GameSettings() { def = new AISettings(AIController.AIType.DEFENSIVE); agg = new AISettings(AIController.AIType.AGGRESSIVE); medPacksAllowed = true; playerHP = 40; flagCompass = true; enemyCompass = true; maxAICount = 4; medPackHealAmount = 5; medPackRndHealAmount = 3; }
public override void OnInspectorGUI() { DrawDefaultInspector(); AISettings settings = target as AISettings; if (settings.useThreading) { if (GUILayout.Button("Abort Search")) { settings.RequestAbortSearch(); } } }
void StartTest() { if (levelGenController != null) { aiSpawnPoints = levelGenController.GetAiSpawns(); playerSpawn = levelGenController.PlayerSpawn(); } agg = new AISettings(AIController.AIType.AGGRESSIVE); agg.SetTestmode(); def = new AISettings(AIController.AIType.DEFENSIVE); def.SetTestmode(); SpawnPlayer(); SpawnNextAI(aiType); }
public override void OnInspectorGUI() { AISettings Target = (AISettings)target; var bs = NavMesh.GetSettingsByID(agentType.intValue); if (bs.agentTypeID != -1) { Rect agentDiagramRect = EditorGUILayout.GetControlRect(false, diagramHeight); UnityEditor.AI.NavMeshEditorHelpers.DrawAgentDiagram(agentDiagramRect, bs.agentRadius, bs.agentHeight, bs.agentClimb, bs.agentSlope); } NavMeshComponentsGUIUtility.AgentTypePopup("Agent Type", agentType); ShowInfo(Target); ObjectFields(Target); }
private void ShowInfo(AISettings settings) { var bs = NavMesh.GetSettingsByID(agentType.intValue); // settings.CalculateStopingDistance(bs.agentRadius); EditorGUILayout.Space(); GUILayout.Label("AI Informations", EditorStyles.boldLabel); EditorGUILayout.LabelField("Radius: " + bs.agentRadius); EditorGUILayout.LabelField("Height: " + bs.agentHeight); EditorGUILayout.LabelField("Max Slope: " + bs.agentSlope); EditorGUILayout.LabelField("Step Height: " + bs.agentClimb); EditorGUILayout.Space(); GUILayout.Label("AI Base Statistic", EditorStyles.boldLabel); // EditorGUILayout.LabelField("AI Stop Distance: " + settings.StopDistance); // EditorGUILayout.LabelField("AI Maximum Speed: " + settings.AgentMaxSpeed); }
public void SetupAI(AISettings settings) { aiEnabled = false; this.maxLP = settings.MaxLP; this.minimumDistance = settings.MinDistance; GetComponent <AIWeaponController>().accuracy = settings.Accuracy; GetComponent <AIWeaponController>().cooldown = settings.CoolDown; GetComponent <AIWeaponController>().maxExtraCooldown = settings.MaxExtraCooldown; GetComponent <AIWeaponController>().shootDistance = settings.ShootDistance; GetComponent <AIWeaponController>().Setup(); if (target == null) { GameObject go = GameObject.FindGameObjectWithTag(enemyTag); if (go != null) { target = go.transform; } } lp = maxLP; this.transform.position = new Vector3(RoundedMath.Mult(Mathf.RoundToInt(this.transform.position.x / boxFactor), boxFactor), this.transform.position.y); aiMovement = GetComponent <AIMovement>(); aiWeaponController = GetComponent <AIWeaponController>(); ea = new EnvironmentAnalyser(); aiMemory = new AIMemory(windowSizeX, windowSizeY, this.transform.position, ea, this, boxFactor); generalSolver = new GeneralSolver(aiMemory); aiMemory.MaxAreaWidth = settings.MaxAreaWidth; aiToTarget = new AIGetToTargetActions(aiMemory, generalSolver, aiMovement, this.transform, target, this, minimumDistance, this); aiWeaponActions = new AIWeaponActions(aiWeaponController); projectileDetector = new ProjectileDetector(this.transform, 10, projectileLayer); aiBehaviorTree = new AIBehaviorTree(aiToTarget, aiWeaponActions, this, projectileDetector); if (aiType == AIType.AGGRESSIVE) { aiBehaviorTree.CreateAndStartAggrassiveAI(); } if (aiType == AIType.DEFENSIVE) { aiBehaviorTree.CreateAndStartDefensiveAI(); } aiEnabled = true; }
public Transform SpawnAI(Vector3 position, Transform aiPrefab, AISettings settings) { ai = (Transform)GameObject.Instantiate(aiPrefab); ai.position = position; ai.GetComponent <AIController>().SetupAI(settings); ai.GetComponent <AIController>().SetDebug(true, false, false); startTime = Time.time; float x = position.x - playerTrans.position.x; float y = position.y - playerTrans.position.y; distance = (float)System.Math.Sqrt(System.Math.Pow(x, 2) + System.Math.Pow(y, 2)); if (aiCam != null) { aiCam.SwitchFocusTo(ai.gameObject); } return(ai); }
public Transform SpawnAI(Vector3 position, Transform aiPrefab, AISettings settings) { Transform ai = Instantiate(aiPrefab); ai.position = position; AIController ctrl = ai.GetComponent <AIController>(); ctrl.OnAiDied.AddListener(t => AIDied(t)); ctrl.SetupAI(settings); Image healthbar = Instantiate(healthBarPrefab); healthbar.rectTransform.SetParent(healthui); healthbar.rectTransform.localScale = new Vector3(1, 1, 1); healthbar.GetComponent <HealthBar>().canvasRectT = healthui; healthbar.GetComponent <HealthBar>().objectToFollow = ai; return(ai); }
void Awake() { actualAIs = new List <Transform>(); startTime = Time.time; highscore.text = "Score: 0000"; GameSettings settings = GameSettingsController.Instance.CurrentSettings; def = settings.Def; agg = settings.Agg; medPacksAllowed = settings.MedPacksAllowed; isScoreGame = GameSettingsController.Instance.IsRanked; scoreboard_id = GameSettingsController.Instance.ScoreboardId; EOGCan.enabled = false; interfaceCan.enabled = true; pauseCan.enabled = false; player.MaxLP = settings.PlayerHP; nameInput.interactable = false; if (!medPacksAllowed && medPacks != null) { Destroy(medPacks); } }
public AssistAI(AISettings settings, Unit assist) : base() { this.settings = settings; AssistUnit = assist; r = AODGameLibrary.Helpers.RandomHelper.Random; int i = (int)(r.NextDouble() * 3); switch (i) { case 0: loveDirection = Vector3.Right; break; case 1: loveDirection = Vector3.Up; break; case 2: loveDirection = Vector3.Normalize(Vector3.Right + Vector3.Up); break; } base.TargetChanged += new EventHandler(RegularAI_TargetChanged); }
public void RestartWithoutDefaultSettings(AISettings s) { aiSettings = s; agent = GetComponent <UnityEngine.AI.NavMeshAgent>(); if (aiSettings.type == AI_TYPE.Basic) { ai = new AIPatrol(ref aiSettings, transform, ref agent); } else if (aiSettings.type == AI_TYPE.Hiding) { ai = new AIWait(ref aiSettings, transform, ref agent); } else if (aiSettings.type == AI_TYPE.Wallhack) { ai = new AIChase(ref aiSettings, transform, ref agent); } else { print("Unimplemented AI Type. Killing Myself.\nI am most likley the phantom without a spawner parent, this is an issue. YOU SHOULD NOT BE SEEING THIS TEXT"); Destroy(gameObject); } AIState.playerGO = GameObject.FindGameObjectWithTag("Player"); }
public AIAttack(ref AISettings settings, Transform transform, ref UnityEngine.AI.NavMeshAgent navAgent) : base(ref settings, transform, ref navAgent) { aiS = settings; t = transform; nav = navAgent; }
public AIProfiles(AISettings initSettings) : this() { this.CurrentKey = AIProfiles.PATH + "\\Default" + AIProfiles.FILE_EXTENSION; this.Settings.Add(this.CurrentKey, initSettings); }
public AIReturnToPatrol(ref AISettings settings, Transform transform, ref UnityEngine.AI.NavMeshAgent navAgent) : base(ref settings, transform, ref navAgent) { aiS = settings; t = transform; nav = navAgent; nav.SetDestination(aiS.patrolPath.NextPoint(t.position, aiS.arrivalDistance, 0)); }
public AIPatrol(ref AISettings settings, Transform transform, ref UnityEngine.AI.NavMeshAgent navAgent) : base(ref settings, transform, ref navAgent) { aiS = settings; t = transform; nav = navAgent; lastIndex = 0; }
public AIState(ref AISettings settings, Transform transform, ref UnityEngine.AI.NavMeshAgent navAgent) { aiS = settings; t = transform; nav = navAgent; }
private void OnEnable() { settings = (AISettings)target; }
public StageSequencerForm(AISettings settings, bool readOnlyMode) { this.InitializeComponent(); this.AISettings = settings; this.ReadOnlyMode = readOnlyMode; }
private void ObjectFields(AISettings settings) { }
public ProfileComboBoxItem(KeyValuePair<string, AISettings> entry) { this.Key = entry.Key; this.Text = this.Key.Substring(this.Key.IndexOf('\\') + 1).Replace(AIProfiles.FILE_EXTENSION, ""); this.Value = entry.Value; }
private void OnEnable() { m_AISettings = serializedObject.targetObject as AISettings; }
public RaidManualSkill(AISettings settings, bool readOnlyMode) { this.InitializeComponent(); this.AISettings = settings; this.ReadOnlyMode = readOnlyMode; }