示例#1
0
 void Start()
 {
     if (!master)
     {
         master = transform.root.gameObject;
     }
     ai            = master.GetComponent <AIenemy>();
     useMecanimMon = ai.useMecanim;
 }
示例#2
0
 void Start()
 {
     if (!master)
     {
         master = transform.root;
     }
     ai = master.GetComponent <AIenemy>();
     gameObject.layer = 2;
     GetComponent <Rigidbody>().isKinematic = true;
     GetComponent <Collider>().isTrigger    = true;
 }
示例#3
0
    void  Start()
    {
        if (waypoints.Length > 1)
        {
            foreach (Transform go in waypoints)
            {
                go.parent = null;
            }
        }
        stat       = GetComponent <Status>();
        ai         = GetComponent <AIenemy>();
        mainModel  = stat.mainModel;
        useMecanim = ai.useMecanim;
        if (!mainModel)
        {
            mainModel = this.gameObject;
        }
        movingAnimation = ai.movingAnimation;
        idleAnimation   = ai.idleAnimation;

        if (!mainModel)
        {
            mainModel = this.gameObject;
        }
        if (waypoints.Length <= 0 && movement != PatrolType.RandomPatrol)
        {
            movement = PatrolType.RandomPatrol;
        }
        //-------Check for Mecanim Animator-----------
        if (useMecanim)
        {
            animator = ai.animator;
            if (!animator)
            {
                animator = mainModel.GetComponent <Animator>();
            }
        }
    }
示例#4
0
    IEnumerator UseSkill()
    {
        AIenemy    ai  = GetComponent <AIenemy>();
        GameObject eff = null;

        if (GetComponent <Status>().freeze || (int)ai.followState == 2)
        {
            yield break;
        }

        int c = 0;

        if (skillSet.Length > 1)
        {
            c = Random.Range(0, skillSet.Length);
        }
        onSkill = true;
        //Cast Effect
        if (skillSet[c].castEffect)
        {
            eff = Instantiate(skillSet[c].castEffect, mainModel.transform.position, mainModel.transform.rotation) as GameObject;
            eff.transform.parent = this.transform;
        }
        //Call UseSkill Function in AIenemy Script.
        ai.UseSkill(skillSet[c].skillPrefab, skillSet[c].castTime, skillSet[c].delayTime, skillSet[c].skillAnimation.name, skillDistance);
        yield return(new WaitForSeconds(skillSet[c].castTime));

        if (eff)
        {
            Destroy(eff);
        }

        yield return(new WaitForSeconds(skillSet[c].delayTime));

        onSkill = false;
    }