Esempio n. 1
0
            public Graph()
            {
                AddedNodes = new List<Node>();
                Junctions = new List<Junction>();
                Nodes = new Dictionary<string, Node>(StringComparer.OrdinalIgnoreCase);

                _lanes = new Lanes(this);
            }
Esempio n. 2
0
        /// <summary>
        /// Creates a new List instance with the selection of all non null cells in the underlying array.
        /// This is a relatively expensive operation, depending on the array length and the AppendIndex value, so
        /// one may consider using the indexer instead.
        /// </summary>
        /// <returns>A read only list of MemoryLane objects.</returns>
        /// <exception cref="ObjectDisposedException">If the MemoryCarriage is disposed.</exception>
        public IReadOnlyList <MemoryLane> GetLanes()
        {
            if (isDisposed)
            {
                throw new ObjectDisposedException("MemoryCarriage");
            }

            return(new List <MemoryLane>(Lanes.NotNullItems()));
        }
Esempio n. 3
0
 public override void SetPosition(int index, Vector3 position)
 {
     base.SetPosition(index, position);
     Lanes.Clear();
     for (int i = 1; i < Count; i++)
     {
         Lanes.Add(GetLane((Points[i - 1] + Points[i]) / 2));
     }
 }
    // 0 North East
    // 1 East
    // 2 South East
    // 3 South West
    // 4 West
    // 5 North West

    // Start is called before the first frame update
    void Start()
    {
        motorwayManager   = GameObject.FindWithTag("MotorwayManager");
        parameters        = motorwayManager.GetComponent <Parameters>();
        vehicleProperties = gameObject.GetComponent <VehicleProperties>();
        lanes             = motorwayManager.GetComponent <Lanes>();
        vehicles          = motorwayManager.GetComponent <Vehicles>();

        StartCoroutine(DoEveryX());
    }
Esempio n. 5
0
        private List <Lane> OrderLanes(Lanes poolLanes)
        {
            if (poolLanes.Lane == null)
            {
                return(new List <Lane>());
            }
            List <Lane> result = poolLanes.Lane.OrderBy(item => item, new LaneIndexComparer(0.001)).ToList();

            return(result);
        }
Esempio n. 6
0
        private bool IsFlightEmpty(int flightId)
        {
            var lanes = ScannerFlights.Where(f => f.FlightId == flightId && f.CountCarsInLane == 0).Select(f => f.LaneId).ToList();

            if (lanes != null && lanes.Count() == Lanes.Count())
            {
                return(true);
            }
            return(false);
        }
Esempio n. 7
0
 public string ChangeScanningType(int laneId)
 {
     if (laneId == 0)
     {
         curentLaneId      = 0;
         currentLaneNumber = 0;
         return("Alternating");
     }
     curentLaneId = laneId;
     return(Lanes.FirstOrDefault(l => l.Id == laneId).Name);
 }
Esempio n. 8
0
 /// <summary>
 /// Disposes a lane at index. This nulls the slot which
 /// will be counted if the lane is disposed directly.
 /// The disposed but not nulled lanes may blow the MAX_LANES threshold at allocation.
 /// </summary>
 /// <param name="index">The slot index.</param>
 public void DisposeLane(int index)
 {
     if (Lanes.AppendIndex >= index)
     {
         var lane = Lanes.Take(index);
         if (lane != null)
         {
             lane.Dispose();
         }
     }
 }
Esempio n. 9
0
 void PlayerInterface.BossAttacked(int damage, Lanes lanesAttacked)
 {
     if (state == PlayerState.Idle || state == PlayerState.Punch || state == PlayerState.Dodging)
     {
         if ((lane & lanesAttacked) != Lanes.None)
         {
             boss.PlayerHurt();
             DoHurt(damage);
         }
     }
 }
Esempio n. 10
0
    void Start()
    {
        Events.OnCrash     += OnCrash;
        Events.OnGameStart += OnGameStart;
        lanes = GetComponent <Lanes> ();

        Add(1, 2);
        Add(2, 4);

        AddNewFollowers();
    }
Esempio n. 11
0
    public void DoRightDodge()
    {
        if (lane != Lanes.R)
        {
            ClearInputQueue();

            attacking = false;
            state     = PlayerState.Dodging;
            lane      = Lanes.R;
            ani.SetTrigger("DodgeRight");
        }
    }
Esempio n. 12
0
    protected void Start()
    {
        this.grid = new Module[maxDepth, height];
        lanes     = GetComponentInParent <Lanes>();
        lane      = GetComponent <HasLane>();
        BoxCollider2D collider = GetComponent <BoxCollider2D>();

        collider.size = new Vector2(lanes.LaneHeight, lanes.LaneHeight * Height);
        Debug.Log(collider.size);
        Debug.Log(lanes.LaneHeight);
        collider.offset = new Vector2(0, collider.size.y / 2f - lanes.LaneHeight / 2f);
    }
Esempio n. 13
0
        public static IEnumerable <BaseObject> CreateCollection(float startX, Lanes lanes, int count, float innerSpace)
        {
            List <BaseObject> coins = new List <BaseObject>();

            if (count < 3)
            {
                return(coins);
            }
            float x = startX;

            //byte l = lanes.GetRandomLane();
            //for (int i = 0; i < count; i++)
            //{
            //	coins[i] = new Coin(x, l);
            //	x += innerSpace;
            //}
            //return coins;

            int sprint = count;

            if (count >= 6)
            {
                if (count <= 9)
                {
                    sprint = EndlessLevelGenerator.random.Next(3, count);
                }
                else
                {
                    sprint = EndlessLevelGenerator.random.Next(3, count - 3);
                }
            }
            byte lane = lanes.GetRandomLane();

            for (int i = 0; i < sprint; i++)
            {
                if (lane > 0)
                {
                    coins.Add(new Coin(x, lane));
                }
                x += innerSpace;
            }
            lane = lanes.GetRandomLane();
            for (int i = sprint; i < count; i++)
            {
                if (lane > 0)
                {
                    coins.Add(new Coin(x, lane));
                }
                x += innerSpace;
            }
            return(coins);
        }
Esempio n. 14
0
 void OnCollisionEnter(Collision collision)                          //faz a pedra parar de se mover
 {
     peixinho.GetComponent <movimentopeixinho>().selecionalane(1);
     control.GetComponent <scenecontroller>().freeze = true;
     txt4.SetActive(true);
     button2.SetActive(true);
     button3.SetActive(true);
     txt1.SetActive(false);
     txt2.SetActive(false);
     txt3.SetActive(false);
     Lanes.SetActive(false);
     peixinho.GetComponent <movimentopeixinho>().speed /= 7;
 }
Esempio n. 15
0
        /// <summary>
        /// Updates the lane list.
        /// </summary>
        public void UpdateLanes()
        {
            SqlCommand cmd = new SqlCommand("SELECT LaneID FROM Lane", connection);

            using (SqlDataReader reader = cmd.ExecuteReader())
            {
                Lanes.Clear();
                foreach (var i in reader)
                {
                    Lanes.Add(reader.GetInt32(0));
                }
            }
        }
    private void Start()
    {
        _forwardIncrease    = 1;
        _maxIncrease        = 2f;
        _increaseSpeedPoint = 200;

        _rb    = GetComponent <Rigidbody>();
        _react = GetComponentInChildren <CharacterReact>();

        _currentlane = Lanes.Center;

        GetComponentInChildren <CharacterAnimations>().Move(true);
    }
Esempio n. 17
0
 public GameSimulator(GameHandler handler, int tickrate)
 {
     _simulationThread = new Thread(() => Simulation())
     {
         IsBackground = true
     };
     _tickDuration     = 1000 / tickrate;
     timeSinceLastTick = DateTime.Now;
     GameHandler       = handler;
     Lanes.Add(new LaneController(GameHandler.Players[0], this));
     Lanes.Add(new LaneController(GameHandler.Players[1], this));
     Start();
 }
Esempio n. 18
0
        public void TranslateTo(Messages.RejectedChange message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            message.AddRoadSegment = new Messages.AddRoadSegment
            {
                TemporaryId          = TemporaryId,
                StartNodeId          = TemporaryStartNodeId ?? StartNodeId,
                EndNodeId            = TemporaryEndNodeId ?? EndNodeId,
                Geometry             = GeometryTranslator.Translate(Geometry),
                MaintenanceAuthority = MaintenanceAuthority,
                GeometryDrawMethod   = GeometryDrawMethod,
                Morphology           = Morphology,
                Status                = Status,
                Category              = Category,
                AccessRestriction     = AccessRestriction,
                LeftSideStreetNameId  = LeftSideStreetNameId.GetValueOrDefault(),
                RightSideStreetNameId = RightSideStreetNameId.GetValueOrDefault(),
                Lanes = Lanes
                        .Select(item => new Messages.RequestedRoadSegmentLaneAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Count        = item.Count,
                    Direction    = item.Direction,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                        .ToArray(),
                Widths = Widths
                         .Select(item => new Messages.RequestedRoadSegmentWidthAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Width        = item.Width,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                         .ToArray(),
                Surfaces = Surfaces
                           .Select(item => new Messages.RequestedRoadSegmentSurfaceAttribute
                {
                    AttributeId  = item.TemporaryId,
                    Type         = item.Type,
                    FromPosition = item.From,
                    ToPosition   = item.To
                })
                           .ToArray()
            };
        }
Esempio n. 19
0
        public House(int variationId, float width, Lanes dangerLanes /*, params float[] catX*/)
        {
            _variation = variationId;
            Width      = width;
            //CatSignature = dangerLanes;

            //_cats = new Cat[3];
            //if (dangerLanes.Has(Lanes.Lane1))
            //	_cats[0] = new Cat(catX[0], 1);
            //if (dangerLanes.Has(Lanes.Lane2))
            //	_cats[1] = new Cat(catX[1], 2);
            //if (dangerLanes.Has(Lanes.Lane3))
            //	_cats[2] = new Cat(catX[2], 3);
        }
 public ChampionToFront(Champion c)
 {
     Name = c.Name;
     for (int i = 0; i < c.Lanes.Count; i++)
     {
         Lanes.Add(c.Lanes[i]);
     }
     Weight      = c.Weight;
     Assistant   = c.Assistant;
     Counter     = c.Counter;
     EnemyAfraid = c.EnemyAfraid;
     WinRate     = c.WinRate;
     BanRate     = c.BanRate;
 }
    public void CenterPlayer()
    {
        switch ((int)_currentlane)
        {
        case 1:
            _rb.AddRelativeForce(Vector3.right * 2500);
            break;

        case 3:
            _rb.AddRelativeForce(Vector3.left * 2500);
            break;
        }

        _currentlane = Lanes.Center;
    }
Esempio n. 22
0
        public string GetLaneTitle(long laneId)
        {
            long parentLaneId = 0;
            Lane parentLane   = Lanes.FirstOrDefault(x => x.ChildLaneIds != null && x.ChildLaneIds.Contains(laneId));

            if (parentLane != null)
            {
                parentLaneId = parentLane.Id.GetValueOrDefault(0);
            }
            if (parentLaneId != 0)
            {
                return(GetLaneTitle(parentLaneId) + ":" + GetLaneById(laneId).Title);
            }
            return(GetLaneById(laneId).Title);
        }
Esempio n. 23
0
        public CardView GetCardViewById(long cardId)
        {
            CardView cardView = Lanes.Where(x => x.Cards != null).SelectMany(l => l.Cards).FirstOrDefault(c => c.Id == cardId);

            if (cardView == null)
            {
                cardView = Backlog.Where(x => x.Cards != null).SelectMany(lane => lane.Cards).FirstOrDefault(c => c.Id == cardId);
            }
            if (cardView == null)
            {
                cardView = Archive.Where(x => x.Cards != null).SelectMany(lane => lane.Cards).FirstOrDefault(c => c.Id == cardId);
            }

            return(cardView);
        }
Esempio n. 24
0
        public Lane GetLaneById(long laneId)
        {
            Lane lane = Lanes.FirstOrDefault(x => x.Id == laneId);

            if (lane == null)
            {
                lane = Backlog.FirstOrDefault(x => x.Id == laneId);
            }

            if (lane == null)
            {
                lane = Archive.FirstOrDefault(x => x.Id == laneId);
            }

            return(lane);
        }
Esempio n. 25
0
    private void Start()
    {
        this.sideConfig              = new Dictionary <Side, SideConfig>();
        this.sideConfig[Side.Left]   = this.leftSide;
        this.sideConfig[Side.Right]  = this.rightSide;
        this.sideConfig[Side.Top]    = this.topSide;
        this.sideConfig[Side.Bottom] = this.bottomSide;

        lanes      = GetComponentInParent <Lanes>();
        castleGrid = FindObjectOfType <ModuleGrid>(); // TODO don't use FindObjectOfType, generally
        lane       = GetComponent <HasLane>();

        BoxCollider2D collider = GetComponent <BoxCollider2D>();

        collider.size = new Vector2(lanes.LaneHeight, lanes.LaneHeight);
    }
Esempio n. 26
0
    public IEnumerator Smash()
    {
        anim.SetTrigger("Prepare");

        RandLane = (Lanes)Random.Range(0, 3);
        anim.SetTrigger(prefix + RandLane);

        yield return(new WaitForSeconds(1.5f));

        anim.SetBool("Smash", true);

        yield return(new WaitForSeconds(1f));

        anim.SetBool("Smash", false);
        manager.StartAttacking();
    }
Esempio n. 27
0
        internal static byte GetRandomLane(this Lanes lanes)
        {
            byte l = (byte)lanes;

            l = lanesArray[l][EndlessLevelGenerator.random.Next(0, lanesArray[l].Length)];
            if (l == last)
            {
                l = lanesArray[l][EndlessLevelGenerator.random.Next(0, lanesArray[l].Length)];
            }
            if (l == last)
            {
                return(0);
            }
            last = l;
            return(l);
        }
Esempio n. 28
0
    public void DoMirrorImage()
    {
        doneMirrorImageAttack = false;
        meltedMirrorImage     = false;

        Poof(poofPoint);
        Poof(leftPoofPoint);
        Poof(rightPoofPoint);
        mirrorWizard1.SetActive(true);
        mirrorWizard2.SetActive(true);

        mirrorWizard1.ResetIdle();
        mirrorWizard2.ResetIdle();
        anim.Play("WizardIdle");

        int randomLane = Random.Range(0, 3);

        switch (randomLane)
        {
        case 0:
            actualLane         = Lanes.L;
            transform.position = wizardLeftPoint.position;
            mirrorWizard1.transform.position = defaultPoint;
            mirrorWizard2.transform.position = wizardRightPoint.position;
            break;

        case 1:
            actualLane         = Lanes.M;
            transform.position = defaultPoint;
            mirrorWizard1.transform.position = wizardLeftPoint.position;
            mirrorWizard2.transform.position = wizardRightPoint.position;
            break;

        case 2:
            actualLane         = Lanes.R;
            transform.position = wizardRightPoint.position;
            mirrorWizard1.transform.position = wizardLeftPoint.position;
            mirrorWizard2.transform.position = defaultPoint;
            break;

        default:
            Debug.Log("Something went very wrong in DoMirrorImage()");
            break;
        }

        Invoke("MirrorImageAttack", 2.0f);
    }
Esempio n. 29
0
 public PoolViewModel(DocumentViewModel documentViewModel, PoolElement poolElement) : this(documentViewModel)
 {
     _poolElement = poolElement;
     BaseElement  = _poolElement;
     int count = 0;
     foreach (LaneElement lane in poolElement.Lanes)
     {
         LaneViewModel laneViewModel = new LaneViewModel(count, this, lane);
         if (count == poolElement.Lanes.Count - 1)
         {
             PropertyChanged += laneViewModel.PoolPropertyChanged;
         }
         Lanes.Add(laneViewModel);
         count++;
     }
     MinHeight = CalculateMinHeight();
 }
Esempio n. 30
0
        /// <summary>
        /// Creates Xpdl Lanes based on LaneElements inside pool
        /// </summary>
        /// <param name="poolElement"></param>
        /// <returns></returns>
        private static Lanes GetLanes(PoolElement poolElement)
        {
            Lanes lanes = new Lanes();

            lanes.Lane = new Lane[poolElement.Lanes.Count];
            for (int i = 0; i < poolElement.Lanes.Count; i++)
            {
                lanes.Lane[i] = new Lane();
                var laneElement = poolElement.Lanes[i];
                lanes.Lane[i].Id                = laneElement.GetId();
                lanes.Lane[i].Name              = laneElement.Name;
                lanes.Lane[i].ParentPool        = poolElement.GetId();
                lanes.Lane[i].NodeGraphicsInfos = new NodeGraphicsInfos();
                lanes.Lane[i].NodeGraphicsInfos.NodeGraphicsInfo    = new NodeGraphicsInfo[1];
                lanes.Lane[i].NodeGraphicsInfos.NodeGraphicsInfo[0] = CreateNodeGraphicsInfo(laneElement, i);
            }
            return(lanes);
        }
Esempio n. 31
0
 public void facePlayer()
 {
     if ((playerCont.lane & Lanes.R) != Lanes.None)
     {
         transform.parent.eulerAngles = new Vector3(0, -25, 0);
         gpLane = Lanes.R;
     }
     else if ((playerCont.lane & Lanes.L) != Lanes.None)
     {
         transform.parent.eulerAngles = new Vector3(0, 25, 0);
         gpLane = Lanes.L;
     }
     else
     {
         transform.parent.eulerAngles = new Vector3(0, 0, 0);
         gpLane = Lanes.M;
     }
 }
Esempio n. 32
0
 public static bool InLane(this Obj_AI_Base obj, Lanes lane)
 {
     return InLane(lane, obj.Position);
 }
Esempio n. 33
0
 public Graph()
 {
     lanes = new Lanes(this);
 }