예제 #1
0
    public override int AddSquareToQueue()
    {
        Square newSquare = ActiveFactory.CreateRandomSquare();

        if (newSquare == null)
        {
            return(-1);
        }

        newSquare.OnSquareHit += HandleSquareHit;

        SpawnOrder.Enqueue(newSquare.SquareIndex);

        return(newSquare.SquareIndex);
    }
예제 #2
0
파일: MitmListner.cs 프로젝트: nikes/Link
        private void ActiveFactory_ConnectionAccept(object sender, ConnectionEventArgs client)
        {
            Connection server;

            try
            {
                server = PassiveFactory.Take();
            }
            catch
            {
                ActiveFactory.Free(client.Connection);
                return;
            }
            ProcessConnections(client.Connection, server);
        }
예제 #3
0
    public void SwitchAnchor()
    {
        if (anchorSquare != null)
        {
            anchorSquare.DestroySquare();
        }

        anchorSquare = ActiveFactory.CreateRandomSquare();

        if (anchorSquare == null)
        {
            throw new Exception("Failed to create anchor");
        }

        anchorSquare.OnSquareHeld += HandleSquareHeld;
        anchorSquare.SetColor(Color.blue);

        anchorIndex = anchorSquare.SquareIndex;

        timeWithoutAnchorHold = 0.0f;
    }
예제 #4
0
    public override int AddSquareToQueue()
    {
        Square newSquare = ActiveFactory.CreateRandomSquare();

        if (newSquare == null)
        {
            return(-1);
        }

        newSquare.OnSquareHit += HandleSquareHit;

        Color nextColor = GetAvailableColor();

        availableColors.Remove(nextColor);
        newSquare.SetColor(nextColor);
        int colorIndex =
            Mathf.Min(colorOrder.IndexOf(nextColor), Mathf.Max(colorSpawnOrder.Count - 1, 0));

        colorSpawnOrder.Insert(colorIndex, nextColor);

        return(newSquare.SquareIndex);
    }
예제 #5
0
파일: MitmListner.cs 프로젝트: nikes/Link
        protected virtual void ProcessConnections(Connection client, Connection server)
        {
            try
            {
                var pair = MakePair();
                ConfigurePair(pair);

                pair.Client.SetupConnection(client, false);
                pair.Server.SetupConnection(server, false);

                Accepting?.Invoke(this, pair);

                pair.Initialize();
                pair.Client.Start();
                pair.Server.Start();

                Accepted?.Invoke(this, pair);
            }
            catch
            {
                ActiveFactory.Free(client);
                PassiveFactory.Free(server);
            }
        }
예제 #6
0
파일: MitmListner.cs 프로젝트: nikes/Link
 public void Stop()
 {
     ActiveFactory.Stop();
 }
예제 #7
0
파일: MitmListner.cs 프로젝트: nikes/Link
 public void Start()
 {
     ActiveFactory.Start();
 }