public Agent(Vector3 spawnPosition) { if (prefab == null) { prefab = Resources.Load <GameObject>("Agent"); } // Instantiate Object gameObject = GameObject.Instantiate(prefab, spawnPosition, Quaternion.identity); rigidbody = gameObject.GetComponent <Rigidbody>(); agentLink = gameObject.AddComponent <AgentObjectLink>(); HPModule = new HitpointsModule(); GunModule = new BaseGun(rigidbody); agentMovement = new AgentMovement(rigidbody); agentAim = new AgentAim(rigidbody); agentLink.Initialize(this, HPModule); }
public void Initialize(Agent agentInstance, HitpointsModule HPModule) { this.agentInstance = agentInstance; this.HPModule = HPModule; }