示例#1
0
        public void CanDelayRequest()
        {
            const int delayMilliseconds = 10;
            var       sut = new DelayHandler(new DelayHandler.Options {
                Value = delayMilliseconds
            });
            var ctx       = RouteContextBuilder.FromUrl("/").Build();
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            var actual = sut.HandleAsync(ctx).Result;

            stopwatch.Stop();

            Assert.Null(actual);
            Assert.InRange(stopwatch.ElapsedMilliseconds, delayMilliseconds, long.MaxValue);
        }
示例#2
0
        public static void LoadAssembly()
        {
            //load delays
            DelayHandler.Load();


            //Initilize Menus
            var champMenu     = new Menus.ChampionMenu();
            var orbwalkerMenu = new Menus.OrbwalkerMenu();
            var antiMenu      = new Menus.AutoMenu();

            //Load Data
            Champion.Player = ObjectManager.Player;
            //Load Menus into SMenu
            antiMenu.Load();
            champMenu.Load();
            orbwalkerMenu.Load();

            _loader = new GeassLib.Loader($"{Champion.Player.ChampionName}", true, true, Data.Level.AbilitySequence, true, true);

            //Add SMenu to main menu
            SMenu.AddToMainMenu();
        }
示例#3
0
 protected override bool Send(StorageTransmission transmission, ref TimeSpan nextSendInterval)
 {
     OnSend(nextSendInterval);
     DelayHandler.Set();
     return(base.Send(transmission, ref nextSendInterval));
 }
示例#4
0
    private void MoveDrops(List <Vector3> myInitialPositions, List <GameObject> instancedDrops)
    {
        for (int i = 0; i < instancedDrops.Count; i++)
        {
            if (instancedDrops[i].GetComponent <Coin>() != null)
            {
                instancedDrops[i].GetComponent <Coin>().Tangible = false;
            }
            if (instancedDrops[i].GetComponent <Key>() != null)
            {
                instancedDrops[i].GetComponent <Key>().Tangible = false;
            }
            switch (instancedDrops[i].GetComponent <LootTable>().GetItemType())
            {
            case LootTable.ItemType.BrownCoin: BrownCoin(i); break;

            case LootTable.ItemType.PurpleCoin: PurpleCoin(i); break;

            case LootTable.ItemType.Key: Key(i); break;
            }
        }
        void Key(int i)
        {
            StartCoroutine(MoveOverTime(instancedDrops[i], myInitialPositions[i], 1f));
            instancedDrops[i].transform.SetParent(m_KeysContainer.transform);
            StartCoroutine(DelayHandler.DelayAction(1, () => instancedDrops[i].GetComponent <Key>().Tangible = true));
        }

        void PurpleCoin(int i)
        {
            StartCoroutine(MoveOverTime(instancedDrops[i], myInitialPositions[i], 1f));
            instancedDrops[i].transform.SetParent(m_CoinsContainer.transform);
            StartCoroutine(DelayHandler.DelayAction(1, () => instancedDrops[i].GetComponent <Coin>().Tangible = true));
        }

        // TODO: This.
        IEnumerator MoveOverTime(GameObject gameObject, Vector3 targetPosition, float durationInSeconds)
        {
            float   timer           = 0f;
            Vector3 initialPosition = gameObject.transform.position;

            while (gameObject.transform.position != targetPosition)
            {
                gameObject.transform.position = Vector3.Lerp(initialPosition, targetPosition, timer);
                timer += Time.deltaTime / durationInSeconds;
                yield return(null);
            }
        }

        void BrownCoin(int i)
        {
            Rigidbody2D rb = instancedDrops[i].AddComponent <Rigidbody2D>();

            instancedDrops[i].AddComponent <Magnet>();
            BoxCollider2D boxTriggerCollider2D = instancedDrops[i].GetComponent <BoxCollider2D>();

            GameObject container = new GameObject();

            container.transform.parent = instancedDrops[i].transform;
            container.layer            = 29; // The layer that only interacts with tiles/barriers/water
            BoxCollider2D myTileCollider = container.AddComponent <BoxCollider2D>();

            myTileCollider.transform.position = instancedDrops[i].transform.position;
            myTileCollider.size = instancedDrops[i].GetComponent <BoxCollider2D>().size;

            rb.useAutoMass = true;
            rb.constraints = RigidbodyConstraints2D.FreezeRotation;
            instancedDrops[i].transform.parent = m_CoinsContainer.transform;
            if (i % 2 == 0)
            {
                rb.AddForce(new Vector2((brownCoinCount) * 4, 60));
            }
            else
            {
                rb.AddForce(new Vector2(-(brownCoinCount) * 4, 60));
            }
            brownCoinCount++;
            StartCoroutine(DelayHandler.DelayAction(1, () => instancedDrops[i].GetComponent <Coin>().Tangible = true));
        }
    }
示例#5
0
 public void Died()
 {
     m_PlayerMovement.enabled = false;
     StartCoroutine(DelayHandler.DelayAction(2f, () => SceneHandler.ReloadCurrentScene()));
 }