protected override void Awake()
    {
        movementAI = GetComponent <BaseNPCMovementAI>();
        switch (job)
        {
        case NPCJobs.Warrior:
            status = new SwordMasterCharacterState(CharacterName);
            movementAI.IsRanger = false;
            gameObject.AddComponent <AttackAI>();
            break;

        case NPCJobs.Archer:
            status = new ArcherCharacterState(CharacterName);
            movementAI.IsRanger = true;
            gameObject.AddComponent <RangeAttackAI>();
            break;

        case NPCJobs.Mage:
            status = new WizzardCharacterState(CharacterName);
            movementAI.IsRanger = true;
            gameObject.AddComponent <RangeAttackAI>();
            break;

        case NPCJobs.Magician:
            status = new MagicianCharacterState(CharacterName);
            movementAI.IsRanger = true;
            gameObject.AddComponent <RangeAttackAI>();
            break;

        case NPCJobs.Knight:
            status = new KnightCharacterState(CharacterName);
            movementAI.IsRanger = false;
            gameObject.AddComponent <AttackAI>();
            break;

        case NPCJobs.Priest:
            status = new PriestCharacterState(CharacterName);
            movementAI.IsRanger = false;
            gameObject.AddComponent <AttackAI>();
            break;

        case NPCJobs.Monster:
            status = new MonsterCharacterState(CharacterName);
            if (movementAI.IsRanger)
            {
                gameObject.AddComponent <RangeAttackAI>();
            }
            else
            {
                gameObject.AddComponent <AttackAI>();
            }
            break;

        default:
            break;
        }
        movementAI.NPCType = NPCType;
        //gameObject.AddComponent<NPCMotion>().model = model;
        movementAI.SetStatus(status);
        base.Awake();
        MakeBloodBar();

        //eargleEyeImgTransform.GetComponent<MeshRenderer>().materials[0].mainTexture = ResourceLoader.NPC.GetFaceicon(job);

        navAgent                  = gameObject.AddComponent <NavMeshAgent>();
        navAgent.height           = BodyHeight;
        navAgent.radius           = BodyWidth / 2;
        navAgent.baseOffset       = 0.01f;
        navAgent.stoppingDistance = BodyWidth;
        navAgent.autoRepath       = true;
        navAgent.autoBraking      = true;
    }
Пример #2
0
 protected override void Awake()
 {
     base.Awake();
     movementAI = GetComponent <BaseNPCMovementAI>();
 }