private void Awake() { _body = new AgentBody(); _physics = new AgentPhysics(transform, GetComponent <Rigidbody2D>(), this); _state = new StateMachine(); _animation = new AgentAnimation(this, GetComponent <SkeletonAnimation>()); _groundcheck = GetComponent <GroundCheck>(); _stats = new AgentStats(this); _agentSkills = GetComponent <AgentSkills>(); _health = GetComponent <AgentHealth>(); _state.ChangeState(new GroundedState(this)); if (tag == "Player") { DeathManager.Player = this; } else { if (DeathManager.Enemies == null) { DeathManager.Enemies = new List <Agent>(); } DeathManager.Enemies.Add(this); } }
public override void InitializeAgent() { isBasic = !(this is AdvancedAgent); defPos = transform.localPosition; defRot = transform.localRotation; Instantiate(shipPrefab, transform); AgentPhysics = GetComponent <AgentPhysics>(); AgentPhysics.Initialize(); InitRays(); }