예제 #1
0
 private void CheckLiveSegmentDelta(LiveSplitState state, string comparison)
 {
     IsLiveDeltaActive = false;
     if (Settings.IsLiveGraph)
     {
         if (state.CurrentPhase == TimerPhase.Running || state.CurrentPhase == TimerPhase.Paused)
         {
             var bestSeg  = LiveSplitStateHelper.CheckLiveDelta(state, true, comparison, state.CurrentTimingMethod);
             var curSplit = state.Run[state.CurrentSplitIndex].Comparisons[comparison][state.CurrentTimingMethod];
             var curTime  = state.CurrentTime[state.CurrentTimingMethod];
             if (bestSeg == null && curSplit != null && curTime - curSplit > MinDelta)
             {
                 bestSeg = curTime - curSplit;
             }
             if (bestSeg != null)
             {
                 if (bestSeg > MaxDelta)
                 {
                     MaxDelta = bestSeg.Value;
                 }
                 if (bestSeg < MinDelta)
                 {
                     MinDelta = bestSeg.Value;
                 }
                 Deltas.Add(bestSeg);
                 IsLiveDeltaActive = true;
             }
         }
     }
 }
예제 #2
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        Vector3 characterPos = world.penguinObj.transform.localPosition;

        characterPos.x += data.xPush * delta.actionDelta * 2;

        data.gravity   += (-4 - data.gravity) * delta.actionDelta * 1;
        characterPos.y += data.gravity * delta.actionDelta * 2;
        //Debug.Log(data.gravity);
        if (characterPos.y < 0)
        {
            characterPos.y = 0;
            data.gravity   = 0;
        }
        if (characterPos.y == 0)
        {
            data.xPush  += (0 - data.xPush) * delta.actionDelta * 10;
            data.gravity = 0;
        }

        if (characterPos.y > 2.9f)
        {
            characterPos.y = 2.9f;
        }

        if (characterPos.x < -1.4f)
        {
            characterPos.x = -1.4f;
        }

        world.penguinObj.transform.localPosition = characterPos;
    }
예제 #3
0
    public static void Parse(ref World world, ref Data data, ref Deltas delta, ref InputsManager controls)
    {
        // Setting Penguin birth (spawn)
        world.penguinObj.transform.localPosition = world.gameStartingSpawn.transform.localPosition;


        data = new Data();

        // Init deltas for stability
        delta = new Deltas {
            actionDelta = 1 / 60,
            mainDelta   = 1 / 60
        };

        // init inputs
        controls = new InputsManager {
            movement = new Vector2(),
            pointer  = new Vector2()
        };


        // Setting initial variables
        // Initial Camera position is set to the spawn
        data.CameraPositionToSpawnPoint = world.gameStartingSpawn.transform.localPosition - world.cam.transform.localPosition;
        // initializing lerped camera to main camera
        data.lerpedCameraPosition = data.CameraPositionToSpawnPoint;
    }
예제 #4
0
        private void AddDelta(MoneyColumnMetadataJsModel col, TableViewModel table, int daysDiff, string name)
        {
            var sequence = table.Values.SkipWhile(v =>
            {
                var s = v.CalculatedCells.GetValueOrDefault(col)?.Value;
                return(s == null || double.IsNaN(s.Value));
            }).OrderByDescending(v => v.When);
            var today   = sequence.FirstOrDefault();
            var baseSet = sequence.FirstOrDefault(v => v.When.Date.AddDays(daysDiff) <= DateTime.Now.Date);

            var todayValue   = today?.CalculatedCells.GetValueOrDefault(col);
            var baseSetValue = baseSet?.CalculatedCells.GetValueOrDefault(col);

            if (todayValue != null && baseSetValue != null)
            {
                Ccy = Ccy ?? todayValue.Ccy;

                IncompleteData |= todayValue.FailedToResolve.Concat(baseSetValue.FailedToResolve).Any();

                var dT = todayValue.AdjustedValue - baseSetValue.AdjustedValue;

                if (dT != null && !double.IsNaN(dT.Value) && !double.IsInfinity(dT.Value))
                {
                    Deltas.Add(new Pair {
                        Name = name, Value = dT.Value
                    });
                }
                else
                {
                    IncompleteData = true;
                }
            }
        }
        public void LoadData()
        {
            try
            {
                var AlphaList = Alpharepo.GetAlphasAsync().Result.ToList();
                ObservableCollection <Alpha> POData = new ObservableCollection <Alpha>();
                foreach (var item in AlphaList)
                {
                    POData.Add(item);
                }
                Alphas = POData;

                var BetaList = Betarepo.GetBetasAsync().Result.ToList();
                ObservableCollection <Beta> BetaData = new ObservableCollection <Beta>();
                foreach (var item in BetaList)
                {
                    BetaData.Add(item);
                }
                Betas = BetaData;

                var GammaList = Gammarepo.GetGammasAsync().Result.ToList();
                ObservableCollection <Gamma> GammaData = new ObservableCollection <Gamma>();
                foreach (var item in GammaList)
                {
                    GammaData.Add(item);
                }
                Gammas = GammaData;

                var DeltaList = DeltaRepo.GetDeltasAsync().Result.ToList();
                ObservableCollection <Delta> DeltaData = new ObservableCollection <Delta>();
                foreach (var item in DeltaList)
                {
                    DeltaData.Add(item);
                }
                Deltas = DeltaData;

                var ThetaList = ThetaRepo.GetThetasAsync().Result.ToList();
                ObservableCollection <Theta> ThetaData = new ObservableCollection <Theta>();
                foreach (var item in ThetaList)
                {
                    ThetaData.Add(item);
                }
                Thetas = ThetaData;

                SelectedBeta  = Betas.First(x => x.Id.Equals(1));
                SelectedGamma = Gammas.First(x => x.Id.Equals(1));
                SelectedAlpha = Alphas.First(x => x.Id.Equals(1));
                SelectedDelta = Deltas.First(x => x.Id.Equals(1));
                SelectedTheta = Thetas.First(x => x.Id.Equals(1));
                SaveText      = null;
            }
            catch (Exception e)
            {
                _logger.Error("Some error have AddRecordViewModel Load data , stacktarce =" + e.StackTrace);
                _logger.Error("AddRecordViewModel error message is " + e.Message + " inner error is " + e.InnerException.Message);
            }
        }
        private void OnAdd()
        {
            Delta _delta = new Delta()
            {
                Name = NewDeltaName
            };

            NewDeltaName = "";
            repo.AddDeltaAsync(_delta);
            Deltas.Add(_delta);
        }
예제 #7
0
        /// <summary>
        /// Determine the difference in listing from now to the last cached listing.
        /// </summary>
        /// <param name="shopID"></param>
        /// <returns></returns>
        public InventoryStatus GetInventoryStatus(int shopID)
        {
            Shop shop = getShopSmart(shopID);

            //Indicated that ShopId Invalud
            if (shop is null)
            {
                return(new InventoryStatus()
                {
                    Shop = new Shop()
                    {
                        Shop_id = shopID,
                        Shop_name = null
                    },
                    IsShopIdValid = false
                });
            }


            ShopInventory previousInventoryState         = syncDatabase.ReadShopInventory(shopID);
            EtsyDataContainer <Listing> listingsFromEtsy = estyAPI.GetActiveListingsByShop(shopID);

            syncDatabase.PersistShopInventory(shop, listingsFromEtsy.Results);

            //Indicates first time request for synchronization.
            if (previousInventoryState == null)
            {
                return(new InventoryStatus()
                {
                    Shop = shop,
                    AsOfDate = DateTime.Today,
                    Added = listingsFromEtsy.Results,
                    Removed = new List <Listing>()
                });
            }

            //Determine the changes between the two lists.
            Deltas <Listing> deltas = determineListingsDeltas(listingsFromEtsy, previousInventoryState.Listings);

            InventoryStatus invStat = new InventoryStatus()
            {
                Shop     = shop,
                AsOfDate = DateTime.Today,
                Added    = deltas.Adds,
                Removed  = deltas.Deletes
            };

            return(invStat);
        }
예제 #8
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        if (data.disableWalk)
        {
            return;
        }

        Vector3 characterPos = world.penguinObj.transform.localPosition;

        characterPos.x += controls.movement.x * delta.actionDelta * settings.characterSpeed;

        world.penguinObj.transform.localPosition = characterPos;

        if (world.penguinObj.transform.localPosition.x > 45)
        {
            data.gameStatus = GameState.WINS_GAME;
        }
    }
예제 #9
0
        internal static ManagedModuleUpdate ToModuleUpdate(this Deltas delta)
        {
            var sequencePointUpdates = delta.LineEdits.SelectAsArray(documentChanges => new SequencePointsUpdate(
                                                                         fileName: documentChanges.SourceFilePath,
                                                                         lineUpdates: documentChanges.Deltas.SelectAsArray(lineChange => new SourceLineUpdate(lineChange.OldLine, lineChange.NewLine))));

            TextManager.Interop.TextSpan toDebuggerSpan(LinePositionSpan span, int lineDelta)
            => new TextManager.Interop.TextSpan()
            {
                // the debugger expects these to be 0-based
                iStartLine  = span.Start.Line + lineDelta,
                iStartIndex = span.Start.Character,
                iEndLine    = span.End.Line + lineDelta,
                iEndIndex   = span.End.Character,
            };

            var activeStatementUpdates = delta.ActiveStatementsInUpdatedMethods.SelectAsArray(activeStatement => new ActiveStatementUpdate(
                                                                                                  threadId: activeStatement.ThreadId,
                                                                                                  methodToken: activeStatement.OldInstructionId.MethodId.Token,
                                                                                                  methodVersion: activeStatement.OldInstructionId.MethodId.Version,
                                                                                                  ilOffset: activeStatement.OldInstructionId.ILOffset,
                                                                                                  newSpan: toDebuggerSpan(activeStatement.NewSpan, 0)));

            var exceptionRegions = delta.NonRemappableRegions.SelectAsArray(
                predicate: regionInfo => regionInfo.Region.IsExceptionRegion,
                selector: regionInfo => new ExceptionRegionUpdate(
                    methodToken: regionInfo.Method.Token,
                    methodVersion: regionInfo.Method.Version,
                    newSpan: toDebuggerSpan(regionInfo.Region.Span, regionInfo.Region.LineDelta),
                    // The range span is the new span. Deltas are inverse.
                    //   old = new + delta
                    //   new = old – delta
                    delta: -regionInfo.Region.LineDelta));

            return(new ManagedModuleUpdate(
                       delta.Mvid,
                       delta.IL.Value,
                       delta.Metadata.Bytes,
                       delta.Pdb.Stream,
                       sequencePointUpdates,
                       delta.Pdb.UpdatedMethods,
                       activeStatementUpdates,
                       exceptionRegions));
        }
        private void ResetUI()
        {
            SelectedBeta  = Betas.First(x => x.Id.Equals(1));
            SelectedGamma = Gammas.First(x => x.Id.Equals(1));
            SelectedAlpha = Alphas.First(x => x.Id.Equals(1));
            SelectedDelta = Deltas.First(x => x.Id.Equals(1));
            SelectedTheta = Thetas.First(x => x.Id.Equals(1));
            Zeus          = null;
            Hera          = null;
            BeginDate     = null;
            EndDate       = null;

            TargetDate = null;
            Artemis    = null;
            Ares       = null;
            Athena     = null;
            Apollo     = null;
            Poseidon   = null;
            Remarks    = null;
        }
예제 #11
0
        private Deltas <Listing> determineListingsDeltas(EtsyDataContainer <Listing> listingsFromEtsy, List <Listing> previousList)
        {
            Dictionary <int, Listing> prevListingAsHashTable = previousList.ToDictionary((l) => l.Listing_id);
            Dictionary <int, Listing> currListingAsHashTable = listingsFromEtsy.Results.ToDictionary((l) => l.Listing_id);

            listingsFromEtsy.Results.ForEach((l) => {
                if (prevListingAsHashTable.ContainsKey(l.Listing_id))
                {
                    prevListingAsHashTable.Remove(l.Listing_id);
                    currListingAsHashTable.Remove(l.Listing_id);
                }
            });

            Deltas <Listing> changes = new Deltas <Listing>()
            {
                Adds    = currListingAsHashTable.Values.ToList(),
                Deletes = prevListingAsHashTable.Values.ToList()
            };

            return(changes);
        }
예제 #12
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        Vector3 characterPos = world.penguinObj.transform.localPosition;
        Vector3 camPos       = world.cam.transform.localPosition;

        float camPosX = camPos.x;
        float camPosY = camPos.y;
        float camPosZ = camPos.z;


        float characterX = characterPos.x;
        float characterY = characterPos.y;


        data.goalCamPos = characterPos - data.CameraPositionToSpawnPoint;


        data.lerpedCameraPosition.x = camPosX + (data.goalCamPos.x - camPosX) * settings.cameraLerpSpeed.x * delta.actionDelta;
        data.lerpedCameraPosition.y = camPosY + (data.goalCamPos.y - camPosY) * settings.cameraLerpSpeed.y * delta.actionDelta;
        data.lerpedCameraPosition.z = camPosZ + (data.goalCamPos.z - camPosZ) * .1f * delta.actionDelta;

        if (data.lerpedCameraPosition.y > 2.4f)
        {
            data.lerpedCameraPosition.y = 2.4f;
        }

        if (data.lerpedCameraPosition.x < -1)
        {
            data.lerpedCameraPosition.x = -1f;
        }

        if (data.lerpedCameraPosition.x > 46)
        {
            data.lerpedCameraPosition.x = 46f;
        }

        world.cam.transform.localPosition = data.lerpedCameraPosition;
    }
예제 #13
0
        static void Main(string[] args)
        {
            TokenResult response;

            while (true)
            {
                try
                {
                    response = client.Post(new AuthLogin {
                        Login = "******", Password = "******"
                    });
                    break;
                }
                catch (Exception)
                {
                }
            }

            client.BearerToken = response.Token;
            visual.BearerToken = response.Token;

            math         = client.Get(new HelpMath());
            optimalSpeed = (math.MaxDuneSpeed + math.MinCanyonSpeed) / 2;
            Deltas       = math.LocationDeltas.ToDictionary(i => i.Direction, i => i.Delta);
            var sessionInfo = client.Post(new Play {
                Map = The_MazeMap
            });

            //var sessionInfo = client.Get(new GetSession {SessionId = $"Bots{RiftMap}" });

            SessionId   = sessionInfo.SessionId;
            CurrentMap  = new Map(sessionInfo.NeighbourCells, sessionInfo.Radius);
            Heading     = sessionInfo.CurrentDirection;
            CurrentCell = CurrentMap.GetCell(sessionInfo.CurrentLocation);
            TargetCell  = CurrentMap.GetCell(sessionInfo.Finish);

            while (Status != PlayerStatusEnum.HappyAsInsane && Status != PlayerStatusEnum.Punished)
            {
                var heading = Heading;
                var @from   = invertedDictionary[CurrentCell.Item1.vector3];
                var to      = invertedDictionary[TargetCell.Item1.vector3];
                ShortestPathResult result = graph.Dijkstra(@from, to); //result contains the shortest path

                var fullpath = result.GetPath();
                var path     = fullpath.Skip(1).FirstOrDefault();
                var cell     = invertedDictionary.FirstOrDefault(pair => pair.Value == path).Key;
                if (cell != null)
                {
                    var delta = cell - CurrentCell.Item1.vector3;
                    var direc = Deltas.FirstOrDefault(pair =>
                                                      pair.Value.Dx == delta.X && pair.Value.Dy == delta.Y && pair.Value.Dz == delta.Z);
                    heading = direc.Key;
                }

                //bool driftWarning = false;
                //int driftDown = 0;

                while (true)
                {
                    int accel   = 0;
                    var nexCell = CurrentMap.GetCell(CurrentCell.Item1, heading);


                    var isTurn = TurnSolution(nexCell, ref heading, ref accel);

                    if (isTurn)
                    {
                        var angle = Math.Abs((int)heading - (int)Heading);
                        if (CurrentSpeed > 0 && angle == 180)
                        {
                            accel = -30;
                        }
                        //foreach (var driftsAngle in math.DriftsAngles)
                        //{
                        //    if (driftsAngle.Angle>=angle && driftsAngle.MaxSpeed>=CurrentSpeed)
                        //    {
                        //        driftDown = CurrentSpeed - driftsAngle.MaxSpeed;
                        //        driftWarning = true;
                        //        heading = heading.TurnLeft();
                        //    }
                        //}

                        //if (!driftWarning)
                        //{
                        //    heading = heading.TurnLeft();
                        //}
                        //else
                        {
                            //nexCell = CurrentMap.GetCell(CurrentCell.Item1, heading);
                            Turn(heading, accel);
                        }
                        break;
                    }
                    else
                    {
                        //if (!GoneCells.ContainsKey(nexCell.Item1.vector3))
                        {
                            heading = heading.TurnLeft();
                        }
                        //else
                        //{
                        //    heading = heading.TurnRight();
                        //}
                    }
                }
            }
        }
예제 #14
0
        public List <List <string> > GetPDFDAta()
        {
            List <List <string> > ListOfRecord = new List <List <string> >();


            foreach (var item in ReportRecords)
            {
                List <string> SingleRecord = new List <string>();
                if (PdfFilterZeus)
                {
                    SingleRecord.Add(item.Zeus);
                }

                if (PdfFilterStatus)
                {
                    SingleRecord.Add(Statuses.First(x => x.Id.Equals(item.StatusID)).Name.ToString());
                }

                if (PdfFilterEndDate)
                {
                    SingleRecord.Add(item.EndDate);
                }

                if (PdfFilterGamma)
                {
                    SingleRecord.Add(Gammas.First(x => x.Id.Equals(item.GammaID)).Name.ToString());
                }

                if (PdfFilterBeta)
                {
                    SingleRecord.Add(Betas.First(x => x.Id.Equals(item.BetaID)).Name.ToString());
                }

                if (PdfFilterAlpha)
                {
                    SingleRecord.Add(Alphas.First(x => x.Id.Equals(item.AlphaID)).Name.ToString());
                }

                if (PdfFilterHera)
                {
                    SingleRecord.Add(item.Hera);
                }

                if (PdfFilterDelta)
                {
                    SingleRecord.Add(Deltas.First(x => x.Id.Equals(item.DeltaID)).Name.ToString());
                }

                if (PdfFilterBeginDate)
                {
                    SingleRecord.Add(item.BeginDate);
                }

                if (PdfFilterPoseidon)
                {
                    SingleRecord.Add(item.Poseidon);
                }

                if (PdfFilterAres)
                {
                    SingleRecord.Add(item.Ares);
                }

                if (PdfFilterAthena)
                {
                    SingleRecord.Add(item.Athena);
                }

                if (PdfFilterTheta)
                {
                    SingleRecord.Add(Thetas.First(x => x.Id.Equals(item.ThetaID)).Name.ToString());
                }

                if (PdfFilterArtemis)
                {
                    SingleRecord.Add(item.Artemis);
                }

                if (PdfFilterTargetDate)
                {
                    SingleRecord.Add(item.TargetDate);
                }

                if (PdfFilterApollo)
                {
                    SingleRecord.Add(item.Apollo);
                }
                ListOfRecord.Add(SingleRecord);
            }

            return(ListOfRecord);
        }
예제 #15
0
 public static void Parse(ref Deltas delta)
 {
     delta.mainDelta   = Time.deltaTime;
     delta.actionDelta = Time.deltaTime /*modifier for SLOW MOTION PENGUINS*/;
 }
예제 #16
0
 public void PopTopColor()
 {
     Deltas.Remove(Deltas.First());
     m_name = null;
 }
예제 #17
0
    public static void Parse(Deltas delta, World world, ref InputsManager controls)
    {
        // Proprietary input system
        ProInput.UpdateInput(delta.mainDelta, true);

        AnalogueInput joystick = ProInput.GlobalActionStick;

        if (joystick.IsActive())
        {
            float stickAngle = joystick.Angle;
            float stickCos   = Mathf.Cos(stickAngle);
            float stickSin   = Mathf.Sin(stickAngle);

            float realJoystickPress = (joystick.Distance - joystick.DeadZone) / (1 - joystick.DeadZone);

            if (stickCos > joystick.DeadZone)
            {
                controls.movement.x = 1;
            }

            if (stickCos < -joystick.DeadZone)
            {
                controls.movement.x = -1;
            }

            //controls.movement.x = stickCos;
            controls.movement.y = stickSin;
        }
        else
        {
            controls.movement.x = 0;
            controls.movement.y = 0;
        }


        // mouse pointer x and y
        Vector3 inputMouseRaw = Input.mousePosition;

        // Needed hack
        inputMouseRaw.z = 10;
        Vector3 mouse = world.cam.camera.ScreenToViewportPoint(inputMouseRaw);

        controls.pointer.x = mouse.x;
        controls.pointer.y = mouse.y;


        // You have to stop holding the action button to press it
        // For constant fire
        if (!controls.holdingActionButton)
        {
            controls.actionButton = ProInput.A;
        }
        if (ProInput.A)
        {
            controls.holdingActionButton = true;
        }
        else
        {
            controls.holdingActionButton = false;
        }


        // You have to stop holding the action button to press it
        // For constant fire
        if (!controls.holdingQuackButton)
        {
            controls.quak = ProInput.B;
        }
        if (ProInput.B)
        {
            controls.holdingQuackButton = true;
        }
        else
        {
            controls.holdingQuackButton = false;
        }
    }
예제 #18
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        bool createAlien = false;

        data.alienTimer += delta.actionDelta * settings.alienAppearance;

        if (data.alienTimer > 1)
        {
            createAlien     = true;
            data.alienTimer = 0;
        }

        Vector3 cameraPosition = world.cam.transform.localPosition;
        Vector3 characterPos   = world.penguinObj.transform.localPosition;

        float cameraUpperBound = cameraPosition.y + settings.cameraBounds.y;
        float cameraLowerBound = cameraPosition.y - settings.cameraBounds.y;
        float cameraRightBound = cameraPosition.x + settings.cameraBounds.x;
        float cameraLeftBound  = cameraPosition.x - settings.cameraBounds.x;

        characterPos.y += settings.penguinYUpPivotFix;

        int alienPoolLen  = world.alienPool.Count;
        int bulletPoolLen = world.bulletPool.Count;

        int  activeAlienIndex    = 0;
        bool areThereActiveAlien = false;


        // pick innactive alien
        for (int i = 0; i < alienPoolLen; i++)
        {
            Alien indexAlien = world.alienPool[i];
            if (!indexAlien.active)
            {
                activeAlienIndex    = i;
                areThereActiveAlien = true;
                break;
            }
        }


        // ACTIVATE first inactive alien
        if (createAlien && areThereActiveAlien)
        {
            Vector3 positionSpawn = new Vector3();

            int quadrant = Mathf.RoundToInt(Random.value * 2) + 1;

            float randomizer = Random.value * 16 - 8;

            if (quadrant == 1)
            {
                positionSpawn.x = cameraLeftBound;
                positionSpawn.y = Mathf.Abs(randomizer - 1) + 1;
            }
            else
            {
                positionSpawn.x = cameraRightBound;
                positionSpawn.y = Mathf.Abs(randomizer - 1) + 1;
            }

            positionSpawn.z = world.gameStartingSpawn.transform.localPosition.z;

            world.alienPool[activeAlienIndex].gameObject.SetActive(true);
            world.alienPool[activeAlienIndex].active = true;
            world.alienPool[activeAlienIndex].transform.localPosition    = positionSpawn;
            world.alienPool[activeAlienIndex].transform.localEulerAngles = new Vector3(0, 0, 0);
        }


        // animate aliens
        for (int i = 0; i < alienPoolLen; i++)
        {
            Alien movingAlien = world.alienPool[i];

            if (!movingAlien.active)
            {
                continue;
            }

            Vector3 alienPosition = movingAlien.transform.localPosition;
            Vector3 alienAngle    = movingAlien.transform.localEulerAngles;

            Vector3 anglePosToChar = alienPosition - characterPos;

            float angle = Mathf.Atan2(-anglePosToChar.y, -anglePosToChar.x);

            Vector3 alienMovement = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0);;

            Vector3 newAlienPosition = alienPosition + alienMovement * delta.actionDelta * settings.alienSpeed;

            movingAlien.transform.localPosition = newAlienPosition;
            alienPosition = movingAlien.transform.localPosition;

            if (alienMovement.x < 0)
            {
                movingAlien.transform.localScale = new Vector3(1, 1, 1);
            }
            else
            {
                movingAlien.transform.localScale = new Vector3(-1, 1, 1);
            }

            //movingAlien.asfasgasfg << action TODO



            for (int j = 0; j < bulletPoolLen; j++)
            {
                Bullet bullet = world.bulletPool[j];

                if (!bullet.active)
                {
                    continue;
                }

                float xDist    = (alienPosition.x - bullet.transform.localPosition.x);
                float yDist    = (alienPosition.y - bullet.transform.localPosition.y);
                float distance = xDist * xDist + yDist * yDist;

                if (distance < .1f)
                {
                    // Enemy Death
                    world.enemydeath.Play();
                    movingAlien.active = false;
                    movingAlien.gameObject.SetActive(false);
                }
            }
        }
    }
예제 #19
0
    public static void Parse(ref Data data, ref World world, Deltas delta, InputsManager controls, Settings settings)
    {
        Vector3 cameraPosition = world.cam.transform.localPosition;
        Vector3 characterPos   = world.penguinObj.transform.localPosition;

        float cameraUpperBound = cameraPosition.y + settings.cameraBounds.y;
        float cameraLowerBound = cameraPosition.y - settings.cameraBounds.y;
        float cameraRightBound = cameraPosition.x + settings.cameraBounds.x;
        float cameraLeftBound  = cameraPosition.x - settings.cameraBounds.x;

        characterPos.y += settings.penguinYUpPivotFix;

        int bulletPoolLen = world.bulletPool.Count;

        int activeBulletIndex = 0;

        // pick innactive bullet
        for (int i = 0; i < bulletPoolLen; i++)
        {
            Bullet indexBullet = world.bulletPool[i];
            if (!indexBullet.active)
            {
                activeBulletIndex = i;
                break;
            }
        }


        // ACTIVATE first inactive bullet
        if (controls.actionButton)
        {
            world.bulletPool[activeBulletIndex].gameObject.SetActive(true);
            world.bulletPool[activeBulletIndex].active = true;
            world.bulletPool[activeBulletIndex].transform.localPosition    = characterPos;
            world.bulletPool[activeBulletIndex].transform.localEulerAngles = new Vector3(0, 0, data.angleToMouse);

            // Character flinging
            data.xPush   = -Mathf.Cos(data.angleToMouse * Mathf.Deg2Rad) * 2;
            data.gravity = -Mathf.Sin(data.angleToMouse * Mathf.Deg2Rad) * 3;

            world.spell2.Play();
        }


        // animate bullets
        for (int i = 0; i < bulletPoolLen; i++)
        {
            Bullet movingBullet = world.bulletPool[i];

            if (!movingBullet.active)
            {
                continue;
            }

            Vector3 bulletPosition = movingBullet.transform.localPosition;
            Vector3 bulletAngle    = movingBullet.transform.localEulerAngles;

            Vector3 bulletMovement = new Vector3(Mathf.Cos(bulletAngle.z * Mathf.Deg2Rad), Mathf.Sin(bulletAngle.z * Mathf.Deg2Rad), 0);;

            Vector3 newBulletPosition = bulletPosition + bulletMovement * delta.actionDelta * settings.bulletSpeed;

            movingBullet.transform.localPosition = newBulletPosition;
            bulletPosition = movingBullet.transform.localPosition;

            if (bulletPosition.x > cameraRightBound ||
                bulletPosition.x < cameraLeftBound ||
                bulletPosition.y > cameraUpperBound ||
                bulletPosition.y < cameraLowerBound)
            {
                movingBullet.gameObject.SetActive(false);
                movingBullet.active = false;
            }
        }
    }
예제 #20
0
 public void GameUpdate(Deltas delta, InputsManager input)
 {
     //GameRunner shall call this to rotate arm to angle
 }
 private void OnDelete()
 {
     repo.DeleteDeltaAsync(SelectedDelta.Id);
     Deltas.Remove(SelectedDelta);
 }