protected override void Start() { base.Start(); OrderAssembler = gameObject.AddComponent <OrderModule>(); Behavior = gameObject.AddComponent <AIModule>(); OrdersSequence = new Queue <Order>(); Agent = GetComponent <NavMeshAgent>(); OrderAssembler.Initialize(this); if (Settings != null) { if (stats.ContainsKey("Speed")) { Agent.speed = stats["Speed"].EffectiveValue; Agent.angularSpeed = stats["Speed"].EffectiveValue * 240; } if (stats.ContainsKey("ShootingRange")) { ShootingRange = stats["ShootingRange"].EffectiveValue; } } Initialize(); if (StartWeapon != null) { EquipWeapon(StartWeapon); } ReferenceType = EntityType.NPC; }
public override void Initialize() { Init(); if (GetComponent <AIModule>() == null) { Behavior = gameObject.AddComponent <AIModule>(); } AITemplate template = new SwarmAITemplate(); template.Initialize(this); Behavior.SetTemplate(template); Behavior.Enabled = true; Agent = GetComponent <NavMeshAgent>(); }