public override void OnInspectorGUI() { FlockingAI ai = (FlockingAI)target; DrawDefaultInspector(); if (ai.debugMode) { EditorGUILayout.Vector3Field("Velocity", ai.Velocity); EditorGUILayout.HelpBox("White = velocity, Green = Allignment, Blue = Cohesion, Red = Seperation, Black = Avoidance", MessageType.Info); } }
// Use this for initialization void Start() { flocking = GetComponent <FlockingAI>(); health = GetComponent <HealthScript>(); SetTargetDestination(Player.position); survival = GetComponent <GoalSurvival>(); eliminate = GetComponent <GoalEliminateThreat>(); patrol = GetComponent <GoalPatrol>(); survival.setParent(this); survival.setCrateManager(CrateManager); eliminate.setParent(this); patrol.setParent(this); }
void Start() { if (instance != null) { Debug.LogError("More than one gamemanager instance found!"); Destroy(this); } FlockingAI.ResetStatics(); instance = this; Random.InitState(_seed); StartCoroutine(LoadAsyncScene()); }
// Use this for initialization void Start() { agents = new GameObject[FlockSize]; for (int i = 0; i < FlockSize; i++) { Vector3 spawnPosition = new Vector3(transform.position.x + Random.Range(-SpawnRange, SpawnRange), 0, transform.position.z + Random.Range(-SpawnRange, SpawnRange)); Vector3 spawnVelocity = new Vector3(Random.Range(-6f, 6f), 0, Random.Range(-6f, 6f)); GameObject agent = Instantiate(AgentPrefab, spawnPosition, transform.rotation); agent.transform.parent = EnemyParent.transform; FlockingAI f = agent.GetComponent <FlockingAI>(); f.SetSpawner(this); f.Velocity = spawnVelocity; f.ObstacleManager = ObstacleManager.GetComponent <ObstacleManager>(); BehaviourAI b = agent.GetComponent <BehaviourAI>(); b.Player = Target; b.SetSpawner(this); b.CrateManager = CrateManager.GetComponent <CrateManagerScript>(); agents[i] = agent; } }