public StraightBlockController(int typeId, ICategoricalObjectPool <AnimationObject> pool, Vector3 playerPlaneCentrePoint, Vector3 backPlaneCentrePoint)
 {
     this.AnimationTypeId        = typeId;
     this.pool                   = pool;
     this.playerPlaneCentrePoint = playerPlaneCentrePoint;
     this.backPlaneCentrePoint   = backPlaneCentrePoint;
     animationDirection          = playerPlaneCentrePoint - backPlaneCentrePoint;
     currObject                  = null;
     isActive = false;
 }
        public bool Update(float timeIndex)
        {
            currObject.UpdateObj(timeIndex);
            if (timeIndex >= 1f)
            {
                // We are done! We should deactivate this object and return it the pool.
                currObject.DeactivateGameObject();
                pool.PoolObject(currObject, AnimationTypeId);
                isActive   = false;
                currObject = null;

                return(true);
            }
            return(false);
        }
        // When this is called, we start playing our animation. Thus, we acquire a GameObject to control, place it in the correct position, configure its direction,
        // and then activate it!
        public bool StartAnimation(GridPosition offset, float scalingFactor, float speed, int comboFactor)
        {
            this.isActive   = true;
            this.currObject = pool.GetObject(this.AnimationTypeId);

            // Calculate the position to spawn the animation object at. This will be the (backPlaneCentrePoint + offset).
            // In this implementation, we assume that we are aligned to the gameworld global axes!
            Vector3 spawnPosition = new Vector3(backPlaneCentrePoint.x + offset.XPos, backPlaneCentrePoint.y + offset.YPos, backPlaneCentrePoint.z);

            currObject.PlaceAtWorldSpace(spawnPosition);
            currObject.SetAnimationDirection(animationDirection);
            currObject.ActivateGameObject();

            return(true);
        }