예제 #1
0
파일: Agent.cs 프로젝트: n1tros/Chocky
    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);
        }
    }
예제 #2
0
 public override void InitializeAgent()
 {
     isBasic = !(this is AdvancedAgent);
     defPos  = transform.localPosition;
     defRot  = transform.localRotation;
     Instantiate(shipPrefab, transform);
     AgentPhysics = GetComponent <AgentPhysics>();
     AgentPhysics.Initialize();
     InitRays();
 }