Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     anim          = gameObject.GetComponent <Animator>();
     _HeroProperty = GameObject.FindGameObjectWithTag("Player").GetComponent <Ctrl_HeroProperty>();
     enemyProperty = GetComponent <Ctrl_Enemy_Property>();
     StartCoroutine(PlayEnemyAnimation());
 }
Esempio n. 2
0
    private CharacterController _cc; //角色控制器

    // Use this for initialization
    void Start()
    {
        _GoHero       = GameObject.FindGameObjectWithTag("Player");
        enemyProperty = gameObject.GetComponent <Ctrl_Enemy_Property>();
        _cc           = gameObject.GetComponent <CharacterController>();
        StartCoroutine(ThinkProcess());
        StartCoroutine(MoveingProcess());
    }
Esempio n. 3
0
    private CharacterController _cc;   //角色控制器

    // Use this for initialization
    void Start()
    {
        //怪物属性脚本
        enemyProperty = GetComponent <Ctrl_Enemy_Property>();
        //怪物控制器
        _cc        = GetComponent <CharacterController>();
        playerUnit = GameObject.FindGameObjectWithTag("Player");
        //保存初始位置信息
        initialPosition = gameObject.GetComponent <Transform>().position;

        //检查并修正怪物设置
        //1. 攻击距离不大于自卫半径,否则就无法触发追击状态,直接开始战斗了
        attackRange = Mathf.Min(defendRadius, attackRange);
        //2. 游走半径不大于追击半径,否则怪物可能刚刚开始追击就返回出生点
        wanderRadius = Mathf.Min(chaseRadius, wanderRadius);

        //随机一个待机动作
        RandomAction();
        StartCoroutine(EnemyAi());
    }