Exemplo n.º 1
0
    void Move(int type)
    {
        Rigidbody2D enemy = OwnerAI.gameObject.GetComponent <Rigidbody2D>();

        //0 break
        if (type == 0)
        {
            enemy.velocity = Vector2.zero;
        }
        if (type == 1)
        {
            enemy.velocity = SlowMovespeed * TopScript.getPlayerAngleV3(OwnerAI.gameObject.transform.position).normalized;
        }
    }
Exemplo n.º 2
0
 public void FixedUpdate()
 {
     for (int i = 0; i < this.runtimeList.Count; i++)
     {
         AIAction temp = (AIAction)this.runtimeList[i];
         if (temp.action.functionType == Actions.ActionType.attack)
         {
             t[i] += Time.fixedDeltaTime;
             if (temp.trigger == TriggerType.distanceIn)
             {
                 if (TopScript.GetPlayerDistance(gameObject) <= DistanceBorder)
                 {
                     if (t[i] >= temp.action.AttackInterval)
                     {
                         t[i] = 0;
                         temp.action.run();
                     }
                 }
             }
             if (temp.trigger == TriggerType.always)
             {
                 if (t[i] >= temp.action.AttackInterval)
                 {
                     t[i] = 0;
                     temp.action.run();
                 }
             }
         }
         if (temp.trigger == TriggerType.distanceOver)
         {
             if (TopScript.GetPlayerDistance(gameObject) > DistanceBorder)
             {
                 temp.action.run();
             }
         }
     }
 }