void Update() { if (delayScript.Check()) { GameObject entity = ObjectPoolManager.GetObjectPool(entityPrefab).PopItem(); entity.transform.position = gameObject.transform.position; delayScript.Start(delay); } }
public void Update() { if (delay.Check()) { ObjectPoolManager.GetObjectPool(gameObject).PushItem(gameObject); } else { gameObject.transform.position += Vector3.up * speedY; } }
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); } }