Example #1
0
    protected virtual void Move()
    {
        // Set Velocity
        velocity.y -= projectileData.gravity.Value * Time.fixedDeltaTime;

        // Move
        transform.Translate(velocity * Time.fixedDeltaTime, Space.World);

        // Update Travle Dist
        float dist = velocity.magnitude * Time.fixedDeltaTime;

        projectileData.travelDist.ModFlat += dist;

        // Detect Object
        if (!DetectCreature(dist))
        {
            DetectWall(dist);
        }

        // On Maxt Distance
        if (projectileData.travelDist.Value >= projectileData.travelDist.Max)
        {
            OnMaxDist();
            ObjPoolingManager.Sleep(this);
        }

        // Rotate Towards Moving Dir
        if (rotateToMovingDir)
        {
            transform.right = velocity.normalized;
        }
    }
Example #2
0
 protected virtual void AnimEvent_DropMagazine()
 {
     if (droppedMagazinePrefab != null)
     {
         ObjPoolingManager.Spawn(droppedMagazinePrefab, magazineDropPos.position, transform.rotation);
     }
 }
Example #3
0
 public static void Sleep(this PoolingObj obj)
 {
     ObjPoolingManager.Sleep(obj);
 }
Example #4
0
 public static T Spawn <T>(this T prefab, Transform parent, Vector2 localPos, bool canCreateNew = true) where T : PoolingObj
 {
     return(ObjPoolingManager.Spawn(prefab, parent, localPos, canCreateNew));
 }
Example #5
0
 public static T Spawn <T>(this T prefab, Vector2 pos, bool canCreateNew = true) where T : PoolingObj
 {
     return(ObjPoolingManager.Spawn(prefab, pos, canCreateNew));
 }
Example #6
0
 private void DisableOnFinish()
 {
     ObjPoolingManager.Sleep(this);
 }
Example #7
0
 protected virtual void SelfSleep()
 {
     ObjPoolingManager.Sleep(this);
 }