Example #1
0
 void Update()
 {
     if (delayScript.Check())
     {
         GameObject entity = ObjectPoolManager.GetObjectPool(entityPrefab).PopItem();
         entity.transform.position = gameObject.transform.position;
         delayScript.Start(delay);
     }
 }
Example #2
0
 public void Update()
 {
     if (delay.Check())
     {
         ObjectPoolManager.GetObjectPool(gameObject).PushItem(gameObject);
     }
     else
     {
         gameObject.transform.position += Vector3.up * speedY;
     }
 }
Example #3
0
    public BTState Move()
    {
        if (!haveWayPoint || moveMaxDelay.Check())
        {
            haveWayPoint = false;
            return(BTState.FAILURE);
        }

        Vector2 offset = (waypoint - entityRigidbody.position).normalized * speed * Time.deltaTime;

        entityRigidbody.MovePosition(entityRigidbody.position + offset);
        if (((Vector2)gameObject.transform.position - waypoint).sqrMagnitude < 0.5f)
        {
            haveWayPoint = false;
            return(BTState.SUCCESS);
        }
        else
        {
            return(BTState.CONTINUE);
        }
    }