public static DumboCar getInstance(MatrixCoords topLeft, Lane lane, int speed) { if (instance == null) instance = new DumboCar(topLeft,lane,speed); return instance; }
// returns index of lane, -1 if not in level public int GetIndexOfLane(Lane lane) { for (int i = 0; i < lanes.Count; i++) if (lanes[i] == lane) return i; return -1; }
public static Lane CreateLane(uint laneId) { Lane lane = new Lane() { m_laneId = laneId }; NetSegment segment = NetManager.instance.m_segments.m_buffer[NetManager.instance.m_lanes.m_buffer[laneId].m_segment]; NetInfo netInfo = segment.Info; int laneCount = netInfo.m_lanes.Length; int laneIndex = 0; for (uint l = segment.m_lanes; laneIndex < laneCount && l != 0; laneIndex++) { if (l == laneId) break; l = NetManager.instance.m_lanes.m_buffer[l].m_nextLane; } if (laneIndex < laneCount) { NetInfoLane netInfoLane = netInfo.m_lanes[laneIndex] as NetInfoLane; if (netInfoLane != null) lane.m_vehicleTypes = netInfoLane.m_allowedVehicleTypes; lane.m_speed = netInfo.m_lanes[laneIndex].m_speedLimit; } NetManager.instance.m_lanes.m_buffer[laneId].m_flags |= Lane.CONTROL_BIT; sm_lanes[laneId] = lane; return lane; }
public static float GetPositionFromLane(Lane lane) { if(lane == Lane.Left) return LeftLanePosition; if(lane == Lane.Middle) return MiddleLanePosition; return RightLanePosition; }
protected GameObject(MatrixCoords topLeft, char[,] body, Lane lane) { this.TopLeft = topLeft; this.lane = lane; int imageRows = body.GetLength(0); int imageCols = body.GetLength(1); this.body = this.CopyBodyMatrix(body); }
public override void spawn(Lane spawnLane) { currentLevel = GameManager.Instance.CurrentLevel; player = GameManager.Instance.CurrentPlayerShips[0]; // should always be the actual player ship transform.position = spawnLane.Back; _currentPlane = currentLevel.GetIndexOfLane(spawnLane); _prevPlane = _currentPlane; }
public void SetTarget(SelectionRegion Selected) { if (Selected == null || !Selected.Enabled || !typeof(SelectionRegion).IsAssignableFrom(Selected.GetType())) { return; } Morphid = Selected.Morphid; Lane = Selected.Lane; Minion = Selected.Minion; }
public Unit Spawn(UnitType unitType, Lane lane, Side side) { int laneNum = (int)lane; GameObject unitGO = unitToPool[unitType].Available; Transform[] spawnPoints = side == Side.Left ? leftSpawnPoints : rightSpawnPoints; Transform spawnPoint = spawnPoints[laneNum]; unitGO.transform.position = spawnPoint.position; Unit unit = unitGO.GetComponent<Unit>(); return unit; }
public Road() : base() { OutgoingLanes = new Lane[] { new Lane(1.5f) }; IngoingLanes = new Lane[] { new Lane(1.5f) }; RoadMesh = new Mesh(); TextureName = ""; RoadWidth = 6; }
//------------------------------------------------------------------ private bool TryChangeLane(Lane lane) { if (driver.TryChangeLane (this, lane, driver.GetChangeLanesDuration())) { driver.Car.EnableBlinker (lane); return true; } return false; }
//------------------------------------------------------------------ public Police(Lane lane, int id, int position) : base(lane, id, position) { Lives = 20; Acceleration = 1.0f; Deceleration = 4.0f; SetDriver (new Drivers.Police (this)); CreateFlasher(); }
public static bool WalkToTurrent(Lane lane, Buildings.TurrentTier tier, float distance, bool allyTurrent = true) { if (allyTurrent) return Player.IssueOrder(GameObjectOrder.MoveTo, Player.Posistion.Extend( Buildings.Ally.Turrents.First(x => x.Position.IsInLane(lane) && x.GetTurrentTier() == tier) .Position, distance).To3DWorld()); return Player.IssueOrder(GameObjectOrder.MoveTo, Buildings.Enemy.Turrents.First(x => x.Position.IsInLane(lane) && x.GetTurrentTier() == tier) .Position.RandomPoint(10)); }
public TimeBonus(MatrixCoords topLeft, Lane lane) : base(topLeft, new char[,] { {' ',' ','_','_',' ',' '}, {' ','/',' ',' ','\\',' '}, {'|','t','i','m','e','|'}, {' ','\\','_','_','/',' '}, }, lane) { this.speed = 1; }
public ChampionMatchItemPurchases(int championId, long matchId, Lane lane, bool isWinner, bool hasSmite) { ChampionId = championId; MatchId = matchId; Lane = lane; IsWinner = isWinner; HasSmite = hasSmite; ItemPurchases = new List<ItemPurchaseInformation>(); }
public Cone(MatrixCoords topLeft, Lane lane) : base(topLeft, new char[,] { {' ',' ',' ',' ',' ',' ',' ',' '}, {' ',' ',' ','/','\\',' ',' ',' '}, {'|','-','/','-','-','\\','-','|'}, {'|','-','-','-','-','-','-','|'}, }, lane) { this.speed = 1; }
private void GenerateLanes() { laneParent.position = Vector3.left * (laneCount - 1) / 2; for (int i = 0; i < laneCount; i++) { Lane newLane = Instantiate(lanePrefab); newLane.transform.SetParent(laneParent); newLane.transform.localPosition = Vector3.right * i; lanes.Add(newLane); } }
//------------------------------------------------------------------ public Player(Lane lane, int id, int position) : base(lane, id, position) { Lives = 80; Velocity = 300; // Acceleration = 1; Acceleration = 0.3f; // Deceleration = 2; Deceleration = 1.0f; SetDriver (new Drivers.Player (this)); }
public LaneAttendance CreateAttendance(Lane lane, User supervisor) { var ret = NRestClient.Create(port: 9000).Execute <LaneAttendance>( RouteConsts.Lane.CreateAttendance.Url, new LaneAttendanceCreate() { Lane = lane, User = supervisor }); return(ret); }
private static void LaneClearMenu() { Lane = Menu.AddSubMenu("Laneclear"); Lane.Add("Q", new CheckBox("Use Q")); Lane.Add("W", new CheckBox("Use W")); Lane.AddSeparator(); Lane.AddLabel("Percent Minions"); Lane.Add("WMin", new Slider("Min minions to W", 3, 1, 10)); Lane.AddSeparator(); Lane.AddLabel("Mana Percent"); Lane.Add("Mana", new Slider("Mana > %", 40, 0, 100)); }
public async Task <Lane> Update(string id, Lane laneIn) { var filter = Builders <Lane> .Filter.Eq(lane => lane.Id, id); var update = Builders <Lane> .Update .Set("Title", laneIn.Title) .Set("Cards", laneIn.Cards); await lanes.FindOneAndUpdateAsync(filter, update); return(lanes.Find <Lane>(lane => lane.Id == id).FirstOrDefault()); }
public override void execute() { // make a lane selection GameObject laneGo = null; bool hadInput = false; // Look for all fingers for (int i = 0; i < Input.touchCount; i++) { Touch touch = Input.GetTouch(i); Ray ray = Camera.main.ScreenPointToRay(touch.position); if (HitUtils.detectHitLane(ray, out laneGo)) { selectionTime += Time.deltaTime; hadInput = true; } } if (!mouseDown && Input.touchCount == 0) { //Touch was released, stop counting selectionTime = 0f; } if (Input.GetMouseButtonUp(0)) { selectionTime = 0f; mouseDown = false; } if (Input.GetMouseButtonDown(0)) { mouseDown = true; } if (mouseDown && Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (HitUtils.detectHitLane(ray, out laneGo)) { selectionTime += Time.deltaTime; hadInput = true; } } if (hadInput && selectionTime >= 1f) { selectionTime = 0f; mouseDown = false; SelectedLane = laneGo.GetComponent <Lane>(); checkReveal(); } }
public Reward(MatrixCoords topLeft, Lane lane, int value) : base(topLeft, new char[,] { {' ',' ','_','_',' ',' '}, {' ','/',' ',' ','\\',' '}, {'|',' ',(char)(value+48),'0',' ','|'}, {' ','\\','_','_','/',' '}, }, lane) { this.value = value; this.speed = 1; }
/* * Spawns Swirlie on same lane as spike */ public override void spawn(Lane spawnLane) { _heightOffset = renderer.bounds.size.y / 2.0f; _shootTime = Time.time; _currentLane = spawnLane; _alive = true; gameObject.transform.position = _currentLane.Back + (renderer.bounds.size.y / 2) * _currentLane.Normal; transform.rotation = Quaternion.LookRotation(_currentLane.Normal); GameObject spike = (GameObject)Instantiate(spikePrefab); _headSpike = spike.GetComponent<Spike>(); _headSpike.init(spawnLane, this); }
public DatabaseResult Create(Lane lane) { try { InMemDb.Db.Lanes.Add(lane); return(DatabaseResult.successful); } catch (Exception) { return(DatabaseResult.failed); } }
private PowerDiff GetPowerDifference(Lane lane) { PowerDiff powerDiff = new PowerDiff(); powerDiff.Direction = PowerDiff.Orientation.None; int allyCount = 0; int enemyCount = 0; foreach (KeyValuePair <Obj_AI_Minion, MinionStruct> minion in minions) { if (minion.Key != null && minion.Key.IsValid && minion.Value.Lane == lane && minion.Value.Active) { if (ObjectManager.Player.Team == minion.Key.Team) { allyCount++; powerDiff.Ally += minion.Value.Power + (minion.Value.Power * GetTurretBonus(minion)); } else { enemyCount++; powerDiff.Enemy += minion.Value.Power + (minion.Value.Power * GetTurretBonus(minion)); } } } if (allyCount > 0 && enemyCount > 0) { int teamDiff = allyCount - enemyCount; if (teamDiff > 4) { powerDiff.Ally += 2; powerDiff.Direction = PowerDiff.Orientation.Ally; } else if (teamDiff < -4) { powerDiff.Enemy += 2; powerDiff.Direction = PowerDiff.Orientation.Enemy; } } else if (enemyCount == 0 && allyCount > 7) { powerDiff.Ally += 2; powerDiff.Direction = PowerDiff.Orientation.Ally; } else if (allyCount == 0 && enemyCount > 7) { powerDiff.Enemy += 2; powerDiff.Direction = PowerDiff.Orientation.Enemy; } return(powerDiff); }
public static void GetCsvData(this Lane lane, out List <CsvPoint> csvPoints, out List <CsvNode> csvNodes, out List <CsvDtLane> csvDtLanes, out List <CsvLane> csvLanes) { csvPoints = new List <CsvPoint>(); csvNodes = new List <CsvNode>(); csvDtLanes = new List <CsvDtLane>(); csvLanes = new List <CsvLane>(); for (int i = 0; i < lane.LineRenderer.positionCount; i++) { var csvPoint = new CsvPoint() { Position = lane.LineRenderer.GetPosition(i) }; csvPoints.Add(csvPoint); var csvNode = new CsvNode() { Point = csvPoint }; csvNodes.Add(csvNode); CsvDtLane csvDtLane; if (i > 0) { csvDtLane = new CsvDtLane() { Point = csvPoint, LastDtLane = csvDtLanes[i - 1] }; } else { csvDtLane = new CsvDtLane() { Point = csvPoint }; } csvDtLanes.Add(csvDtLane); if (i > 0) { var csvLane = new CsvLane() { DtLaneFinal = csvDtLane, BeginNode = csvNodes[i - 1], FinalNode = csvNode }; if (i > 1) { csvLane.AddPreLane(csvLanes[i - 2]); } csvLane.Velocity = Mathf.Lerp(lane.velocityBegin, lane.velocityFinal, (float)i / (lane.LineRenderer.positionCount - 1)); csvLanes.Add(csvLane); } } }
public void GetXAxis() { if (Lane.GetType() == typeof(KioskDisplayLane) && Person.IsFirstRun) { XAxis = Lane.LeftMargin; } else { var position = RandomNumber(Lane.LeftMargin.ToInt(), (Lane.RightMargin - Label.ActualWidth).ToInt()); XAxis = position; } }
private RangeFloat GetBoundsOn(Lane lane) { Bounds bounds3D = GetWorldspaceBounds(); Vector3 back = bounds3D.center + Vector3.back * bounds3D.extents.z; Vector3 front = bounds3D.center + Vector3.forward * bounds3D.extents.z; float min = lane.GetPositionOnLane(back); float max = lane.GetPositionOnLane(front); return(new RangeFloat(min, max)); }
protected void OnTriggerLane(Collider2D _col) { Lane _lane = _col.gameObject.GetComponent <Lane>(); if (velocity.y < 0) { if (lane == _lane.index) { JumpFinish(); } } }
private static Lane TrySetLane(int enemy, List <Lane> freeLanes, Lane freeLane) { freeLanes.Remove(freeLane); if (freeLane.LaneHightStep >= enemy) { return(freeLane); } else { return(null); } }
//------------------------------------------------------------------ public Player(Lane lane, int id, int position, Weight weight, string textureName) : base(lane, id, position, weight, textureName) { Lives = 80; Velocity = 300; // Acceleration = 1; Acceleration = 0.3f; // Deceleration = 2; Deceleration = 1.0f; Driver = new Drivers.Player(this); }
public OtherCar(MatrixCoords topLeft, Lane lane) : base(topLeft, new char[, ] { { ' ', ' ', '_', '_', '_', ' ', ' ' }, { ' ', '/', '_', '_', '_', '\\', ' ' }, { '.', '"', ' ', '|', ' ', '"', '.' }, { '(', 'o', '_', '|', '_', 'o', ')' }, { ' ', 'u', ' ', ' ', ' ', 'u', ' ' }, }, lane) { this.speed = 1; }
public void Start() { activeMinions = new List<GameObject>(); projectile = this.GetProvider().GetAbility<Projectile>(); spawn = this.GetProvider().GetAbility<Spawn>(); colorChanger = GetComponent<ColorChanger>(); target = GetComponent<Target>(); spawn.Enable(target.Team, new LaneElement[]{GetComponent<LaneElement>()}, colorChanger.color); teamSelector = TargetManager.IsOpposing(target); GetComponent<CharacterEventListener>().AddCallback(CharacterEvents.Hit, Activate); lane = GetComponent<Lane>(); }
public Reward(MatrixCoords topLeft, Lane lane, int value) : base(topLeft, new char[, ] { { ' ', ' ', '_', '_', ' ', ' ' }, { ' ', '/', ' ', ' ', '\\', ' ' }, { '|', ' ', (char)(value + 48), '0', ' ', '|' }, { ' ', '\\', '_', '_', '/', ' ' }, }, lane) { this.value = value; this.speed = 1; }
//------------------------------------------------------------------ public bool CheckLane(Lane lane) { if (lane == null) { return(false); } var closestAhead = FindClosestCar(lane.Cars.Where(IsCarAhead)); var closestBehind = FindClosestCar(lane.Cars.Where(car => !IsCarAhead(car))); return(CheckCar(closestAhead) && CheckCar(closestBehind)); }
public LaneItem(List <Definitions.Effects> effects, Lane lane, string name, float width, float height, Vector3 position) : base("Lane" + name, lane) { this.effectsOverride = effects; body.transform.localScale = new Vector3(width, 1, height); meshRenderer.material.color = Color.grey; label.SetColor(Color.white); label.SetText(name); this.position = position; heldItem = null; }
public void changeEnemyLane(Enemy enemy, Lane lane) { enemy.transform.SetParent(lane.transform); sortInLayersByLane(enemy.gameObject, lane.id); Vector2 pos = enemy.transform.localPosition; pos.y = 0; enemy.transform.localPosition = pos; enemy.laneId = lane.id; }
public OtherCar(MatrixCoords topLeft, Lane lane) : base(topLeft, new char[,] { {' ',' ','_','_','_',' ',' '}, {' ','/','_','_','_','\\',' '}, {'.','"',' ','|',' ','"','.'}, {'(','o','_','|','_','o',')'}, {' ','u',' ',' ',' ','u',' '}, }, lane) { this.speed = 1; }
void CreateObject(int type, Lane lane, float posZ) { Transform prefab = prefabs[type]; Transform parent = transform.GetChild(type); Instantiate(prefab, new Vector3(GameManager.lanePositions[lane], prefab.position.y, posZ), prefab.rotation, parent); // Destroy passed objects //if(player.position.z > parent.GetChild(0).position.z) // Destroy(parent.GetChild(0).gameObject); }
private void Start() { rend = GetComponent <Renderer>(); material = GetComponent <Renderer>().material; rend.enabled = true; if (id.IsNullOrEmpty()) { id = gameObject.GetComponentInParent <Lane>().id; } lane = gameObject.GetComponentInParent <Lane>(); }
public byte[] Serialize() { var bytes = new List <byte>(); bytes.AddRange(Etag.ToBytes(24)); bytes.AddRange(Station.ToBytes()); bytes.AddRange(Lane.ToBytes()); bytes.AddRange(Plate.ToBytes(10)); bytes.AddRange(TID.ToBytes(12)); bytes.AddRange(HashValue.ToBytes(8)); return(bytes.ToArray()); }
void OnTriggerEnter2D(Collider2D col) { if (!mDead && mIsInUse) { Lane colLane = col.GetComponent <Lane>(); Plank plank = col.GetComponent <Plank>(); Player othrplayer = col.GetComponent <Player>(); if (othrplayer != null && othrplayer.mTopPlayer != mTopPlayer && !mJumping) { Debug.Log("Dead"); mDead = true; DeathAnimation(); } if (!mDead) { if (plank != null) { mIsOnPlank = true; this.gameObject.transform.parent = plank.gameObject.transform; Vector3 plankScale = plank.gameObject.transform.localScale; // this.gameObject.transform.localScale =new Vector3(plankScale.x/ mInitialScale.x , plankScale.y/mInitialScale.y ,0); } if (colLane != null) { if (colLane.IsRiver) { if (!mIsOnPlank) { Debug.Log("Dead"); mDead = true; DeathAnimation(); } else { Debug.Log("Is on Plank"); } } else { if (colLane.Id == mDestinationLaneId) { mDead = true; ScoreAnimation(); OnScored?.Invoke(mTopPlayer); } } } } } }
public void TestAddCourseAndAssignMonitor() { Pool pool = service.FindPoolByZipCode(46122); service.AddCourse(pool, "TestCourse 1", new DateTime(2018, 1, 8), new DateTime(2018, 6, 25), createTime(18, 0, 0), new TimeSpan(0, 45, 0), Days.Tuesday | Days.Thursday, 10, 20, 110, new List <int> { 5, 6 }); // check course has been added to pool and is stored (can be found by Id) Course course = service.FindCourseByName("TestCourse 1"); Assert.IsNotNull(course); Assert.IsTrue(pool.Courses.Contains(course)); // check course details Assert.AreEqual(new DateTime(2018, 1, 8), course.StartDate); Assert.AreEqual(new DateTime(2018, 6, 25), course.FinishDate); Assert.AreEqual(createTime(18, 0, 0).TimeOfDay, course.StartHour.TimeOfDay); Assert.AreEqual(new TimeSpan(0, 45, 0), course.Duration); Assert.AreEqual(course.CourseDays & Days.Tuesday, Days.Tuesday); Assert.AreEqual(course.CourseDays & Days.Thursday, Days.Thursday); Assert.AreEqual(110, course.Price); Assert.IsNull(course.Monitor); // check lanes <--> course relationships Assert.AreEqual(2, course.Lanes.Count); Lane lane5 = pool.FindLaneByNumber(5); Lane lane6 = pool.FindLaneByNumber(6); Assert.IsTrue(course.Lanes.Contains(lane5)); Assert.IsTrue(course.Lanes.Contains(lane6)); Assert.IsTrue(lane5.Courses.Contains(course)); Assert.IsTrue(lane6.Courses.Contains(course)); // check monitor assignment Monitor monitor = service.GetAvailableMonitors(course).First(); service.SetCourseMonitor(course, monitor); Assert.AreEqual(monitor, course.Monitor); Assert.IsTrue(monitor.Courses.Contains(course)); service.AddCourse(pool, "TestCourse 2", new DateTime(2018, 2, 8), new DateTime(2018, 6, 25), createTime(18, 30, 0), new TimeSpan(0, 45, 0), Days.Tuesday | Days.Friday, 10, 20, 110, new List <int> { 8, 10 }); Course course2 = service.FindCourseByName("TestCourse 2"); Assert.IsFalse(monitor.IsAvailableFor(course2)); // He modificat les lanes del segon perque concidixen en les del primer i no es correcte el test }
private bool MoveAnimalInBridgeLane() { if (Lane == null || !BridgePosition.HasValue) { var error = $"Something went wrong. This Animal is not in a Queue and is not currently in a bridge lane. Cannot move"; this.Log(error); return(false); } var currentPosition = BridgePosition.Value; var isFinishedCrossing = false; if (BridgePredecessor == null) { if (Lane.Last() == this) { switch (this.Side) { case BridgeSide.Left: this.Bridge.LeftCrossedAnimals.Add(this); break; case BridgeSide.Right: this.Bridge.RightCrossedAnimals.Add(this); break; default: var error = $"Something went wrong. This Animal has already completed crossing the bridge. Cannot move."; this.Log(error); return(false); } this.Side = BridgeSide.Unspecified; this.Bridge.CrossingAnimalCount--; isFinishedCrossing = true; } else { this.Lane[currentPosition + 1] = this; } this.Lane[currentPosition] = null; this.Log($" Moved Successfully."); if (isFinishedCrossing) { this.Log($" Finished Crossing."); this.Lane = null; } return(true); } this.Log($" has to wait. The bridge position in front of it is occupied."); return(false); }
// programmatically makes lanes at startup based on a config for how many lanes the specific conquest needs public override void _Ready() { var laneTypes = CityInfo.Instance.currentCity.lanesInfo; // set the number of lanes and position of the parent of the lanes (this node) based off dict // it's hard coded, but no other way :/ numLanes = laneTypes.Count; this.Position = new Vector2(700.5f, yPositionForNumLanes[numLanes]); // Calculate how much x and y space we have in total ColorRect TopBar = (ColorRect)GetParent().FindNode("TopBar"); ColorRect BottomBar = (ColorRect)GetParent().FindNode("BottomBar"); ColorRect ArmyBase = (ColorRect)GetParent().FindNode("ArmyBase"); float lanesXAvailable = GetViewportRect().Size.x - ArmyBase.RectSize.x; float lanesYAvailable = GetViewportRect().Size.y - TopBar.RectSize.y - BottomBar.RectSize.y; // Figure out how much y space for each lane yPixelsForEachLane = lanesYAvailable / numLanes; // info about which lane in the list we're on -- used to set position of the lane later int laneIndex = 0; foreach (Enums.LaneTypes type in laneTypes) { // get their info var laneDetails = LaneInfo.Instance.laneInfoList[type]; // make new lane and set some info Lane newLane = GD.Load <PackedScene>("res://src/combat/lanes/Lane.tscn").Instance <Lane>(); newLane.laneImg = laneDetails.image; newLane.Curve = laneDetails.curve; newLane.Position = new Vector2(0, yPixelsForEachLane * laneIndex); // calculate scale of the lane texture float imgXScale = lanesXAvailable / laneDetails.image.GetWidth(); float imgYScale = yPixelsForEachLane / laneDetails.image.GetHeight(); Vector2 newScaleVector = new Vector2(imgXScale, imgYScale); // get sprite and set scale Sprite newLaneSprite = newLane.GetNode <Sprite>("Sprite"); newLaneSprite.Scale = newScaleVector; // get button and set the position (using the scale, its weird) TextureButton button = newLane.GetNode <TextureButton>("Button"); button.RectPosition *= newScaleVector; lanes.Add(newLane); AddChild(newLane); laneIndex++; } }
IEnumerator SpawnEnemies(List <int> enemies) { spawning = true; foreach (int enemy in enemies) { Lane lane = null; if (wave * 0.2f < laneHightStepMax) { while (lane == null) { List <Lane> freeLanes = laneArray.Where(n => !n.HasAirship).ToList(); while (freeLanes.Count > 0 && lane == null) { Lane freeLane = freeLanes[Random.Range(0, freeLanes.Count)]; if (freeLane.LaneHightStep < wave * 0.2f) { lane = TrySetLane(enemy, freeLanes, freeLane); } else { freeLanes.Remove(freeLane); } } if (lane == null) { yield return(new WaitForSeconds(0.2f)); } } SpawnNewEnemy(enemy, lane); yield return(new WaitForSeconds(0.1f)); } else { while (lane == null) { List <Lane> freeLanes = laneArray.Where(n => !n.HasAirship).ToList(); while (freeLanes.Count > 0 && lane == null) { Lane freeLane = freeLanes[Random.Range(0, freeLanes.Count)]; lane = TrySetLane(enemy, freeLanes, freeLane); } if (lane == null) { yield return(new WaitForSeconds(0.2f)); } } SpawnNewEnemy(enemy, lane); yield return(new WaitForSeconds(0.1f)); } } spawning = false; }
private void CalculateNetwork() { _BeginNodes.Clear(); _EndNodes.Clear(); ClearLinks(); Lane[] lanes = gameObject.GetComponents <Lane>(); for (int i = 0; i < lanes.Length; i++) { Destroy(lanes[i]); } for (int i = 0; i < _ConnectedRoads.Count; i++) { if (_ConnectedRoads[i]._LaneBeginPoint) { _BeginNodes.Add(_ConnectedRoads[i]._LaneBeginPoint); } if (_ConnectedRoads[i]._LaneEndPoint) { _EndNodes.Add(_ConnectedRoads[i]._LaneEndPoint); } } for (int i = 0; i < _BeginNodes.Count; i++) { for (int j = 0; j < _EndNodes.Count; j++) { if (_BeginNodes[i].parent == _EndNodes[j].parent) { continue; } Lane link = gameObject.AddComponent <Lane>(); if (_ConnectedRoads.Count > 2) { link.maxDrivingSpeed = _DrivingSpeed; } link._Nodes[1] = _BeginNodes[i]; AddLink(link); _EndNodes[j].AddLink(link, 0); float angle = Vector2.Angle(_BeginNodes[i].parent._WorldDirection, -_EndNodes[j].parent._WorldDirection); if (angle > 5) { link.path = CalculatePath(_BeginNodes[i].position, CalculateIntersectPoint(_BeginNodes[i].position, -_BeginNodes[i].parent._WorldDirection, _EndNodes[j].position, -_EndNodes[j].parent._WorldDirection, true), _EndNodes[j].position); } } } }
internal static void InMenu() { Caiy = MainMenu.AddMenu("Caitlyn", "Caitlyn"); Caiy.Add("AutoAtack", new CheckBox("Use Atack Buff [Enemy]")); pre = Caiy.AddSubMenu("Prediction"); pre.Add("HitQ", new ComboBox("HitChance [Q]", 1, "Low", "Medium", "High")); pre.Add("HitW", new ComboBox("HitChance [W]", 2, "Low", "Medium", "High")); pre.Add("HitE", new ComboBox("HitChance [E]", 1, "Low", "Medium", "High")); Comb = Caiy.AddSubMenu("Combo"); Comb.Add("Qc", new CheckBox("Use [Q]")); Comb.Add("Wc", new CheckBox("Use [W]")); Comb.Add("Ec", new CheckBox("Use [E]")); Comb.AddSeparator(); Comb.AddLabel("Settings [R]"); Comb.Add("Rf", new CheckBox("Use [R] Fish Enemy")); Comb.AddSeparator(); Comb.Add("ModoR", new ComboBox("Mode [R]", 0, "Fish [R]", "Beta Mode [R]")); Comb.AddSeparator(); Comb.AddLabel("Settings [Beta Mode R]"); Comb.Add("LR", new Slider("Minimal of the Enemy's Life", 20, 1, 100)); Comb.AddSeparator(); Comb.AddLabel("Enemys, No Use on whom?"); foreach (var enemies in EntityManager.Heroes.Enemies.Where(caity => !caity.IsMe)) { Comb.Add("CaitlynUti" + enemies.ChampionName, new CheckBox("" + enemies.ChampionName, false)); } Auto = Caiy.AddSubMenu("Auto Harass"); Auto.Add("AutoQ", new CheckBox("AutoHarass [Q]")); Auto.AddSeparator(); Auto.AddLabel("Mana Percent"); Auto.Add("ManaQ", new Slider("Mana Percent [Q] > {0}", 65, 1)); Lane = Caiy.AddSubMenu("Lane [Clear]"); Lane.Add("Ql", new CheckBox("Use [Q] Lane")); Lane.AddSeparator(); Lane.AddLabel("Mana Percent"); Lane.Add("ManaL", new Slider("Mana Percent > {0}", 50, 1, 100)); Lane.AddSeparator(); Lane.AddLabel("Minions"); Lane.Add("Qmi", new Slider("Minion Percent > {0}", 3, 1, 6)); Jungle = Caiy.AddSubMenu("Jungle [Clear]"); Jungle.Add("Qj", new CheckBox("Use [Q] Jungle")); Jungle.AddSeparator(); Jungle.AddLabel("Mana Percent"); Jungle.Add("Q/J", new Slider("Mana Percent [Q/E]", 65, 1)); Misc = Caiy.AddSubMenu("Misc"); Misc.Add("Ks", new CheckBox("KillSteal")); Draws = Caiy.AddSubMenu("Draws [Spells]"); Draws.Add("DQ", new CheckBox("[Q] Draws")); Draws.Add("DW", new CheckBox("[W] Draws")); Draws.Add("DE", new CheckBox("[E] Draws")); Draws.Add("DR", new CheckBox("[R] Draws")); }
/////////////////////////////////////////////////////////////////////////////////// /// <summary> /// プレイヤーの攻撃の処理を行う /// </summary> /// <param name="playerID">プレイヤーのID</param> /// <param name="attackLane">攻撃するレーンの位置(enum)</param> public void Attack(int playerID, Lane attackLane) { ShotAnim(playerID, attackLane); if (PlaySceneManager.SceneManager.GetSetNowCondition == PlaySceneManager.Condition.Reverse) { playerID = playerID == 0 ? 1 : 0; } if (PlaySceneManager.SceneManager.GetSetNowCondition == PlaySceneManager.Condition.Composite) { CompositeAttack(playerID, attackLane); return; } if (playerID == 0) { energySE.Play(); } else { overSE.Play(); } GameObject m_hitTargetObject = null; Transform m_shotTransform = null; if (attackLane == Lane.Center) { m_shotTransform = centerRayTransform[playerID]; } if (attackLane == Lane.Right) { m_shotTransform = rightRayTransform[playerID]; } if (attackLane == Lane.Left) { m_shotTransform = leftRayTransform[playerID]; } m_hitTargetObject = AttackRayCast(m_shotTransform); //Rayによる命中判定を行う Debug.Log("m_hitTargetObject" + m_hitTargetObject); if (m_hitTargetObject != null) { StartCoroutine(BulletSpawn(m_hitTargetObject.transform, playerID)); } else { GameObject m_endPosition = new GameObject(); m_endPosition.transform.position = m_shotTransform.position + (m_shotTransform.transform.forward * attackDistance); Destroy(m_endPosition, 3); StartCoroutine(BulletSpawn(m_endPosition.transform, playerID)); } }
private DumboCar(MatrixCoords topLeft, Lane lane, int speed) : base(topLeft, new char[,] { {' ',' ','_','_','_',' ',' '}, {' ','/','_','_','_','\\',' '}, {'.','"',' ','|',' ','"','.'}, {'(','o','_','|','_','o',')'}, {' ','u',' ',' ',' ','u',' '}, }, lane) { this.speed = speed; this.points = 0; }
/* * Spawns Confetti on alne and sets destination */ public override void spawn(Lane spawnLane) { _currentLane = spawnLane; _alive = true; _isInMiddle = true; getNewDestination(); gameObject.transform.position = _currentLane.Back; _atBackOfLane = true; _currentTargetPoint = _currentLane.RightEdge.Back; _currentStartPoint = _currentLane.RightEdge.Back; _destination = _currentLane.RightEdge.Back; _destinatioLane = _currentLane; }
public void Reset(Obj_AI_Base myTower, Obj_AI_Base enemyTower, Lane ln) { Vector3 pingPos = AutoWalker.p.Distance(AutoWalker.MyNexus) - 100 > myTower.Distance(AutoWalker.MyNexus) ? enemyTower.Position : myTower.Position; Core.DelayAction(() => SafeFunctions.Ping(PingCategory.OnMyWay, pingPos.Randomized()), RandGen.r.Next(3000)); lane = ln; currentWave = new Obj_AI_Minion[0]; myTurret = myTower; enemyTurret = enemyTower; randomExtend = 0; currentLogic.SetLogic(LogicSelector.MainLogics.PushLogic); }
void CreatePlayerFromLane(Lane givenLane) { foreach (IPlayerProvider provider in playerProviderLoader.GetPlayerProvider()) { if (provider.IsValidPlayertype(givenLane.playerType)) { IPlayer player = provider.GetPlayer(givenLane.playerConfig); player.ParentId = givenLane.parentId; players[givenLane.ergId] = player; laneList.UpdatePlayer(player); } } }
public Spill(MatrixCoords topLeft, Lane lane) : base(topLeft, new char[,] { {' ',' ',' ','.','.',' ',' '}, {' ',' ','.','.','.','.',' '}, {' ','.','.','.','.','.','.'}, {'.','.','.','.','.','.','.'}, {'.','.','.','.','.','.','.'}, {' ','.','.','.','.','.',' '}, {' ',' ','.','.','.',' ',' '}, }, lane) { this.speed = 1; }
//------------------------------------------------------------------ public Car(Lane lane, int id, int position) : base(lane) { LocalPosition = new Vector2 (0, position); SetLane (lane); ID = id; Velocity = Lane.Velocity; Lives = GeLives(); Acceleration = 1.0f;// * weight.Acceleration; Deceleration = 1.5f;// * weight.Deceleration; SetDriver (new Common (this)); }
/// <summary> /// Initializes a new instance of the <see cref="Car"/> class. /// </summary> /// <param name="direction">The direction in which the <see cref="Car"/> is going.</param> /// <param name="color">The color of the <see cref="Car"/>.</param> /// <param name="lane">The <see cref="Traffic_Light_Simulator.Lane"/> in which the <see cref="Car"/> currently is.</param> public Car(Direction direction, Color color, Lane lane) { this.Lane = lane; this.Direction = direction; this.Speed = 0; this.Position = direction == Direction.LEFT ? lane.CarStartingPositionLeftLane : lane.CarStartingPositionStraightAndRightLane; this.HitBox = new Rectangle(this.Position.X, this.Position.Y, CAR_WIDTH, CAR_HEIGHT); this.MovingBehaviour = MoveBehaviour.ACCELERATE; this.Color = color; TrafficTimer.Timer.Elapsed += (s, e) => Move(this.MovingBehaviour); }
public void Initialize(Vector3 s, Vector3 e, int iS, int iE, int laneNb, float speed){ //initialize zombie as walking currState = State.Walking; if(laneNb == 0) currLane = Lane.Inner; else if(laneNb == 1) currLane = Lane.Middle; else currLane = Lane.Outer; maxSpeed = speed; currSpeed = speed; start = s; end = e; iStart = iS; iEnd = iE; direction = (end - start).normalized; }
// Data object creator sets attribute values in constructor. public Vehicle( UInt32 id, Lane lane, Coordinates position, Double heading, Double velocity ) { this.VehicleID = id; this.RoadID = lane.ParentWay.ParentRoad.RoadID; this.WayID = lane.ParentWay.WayID; this.LaneID = lane.LaneID; this.Position = position; this.Heading = heading; this.Velocity = velocity; }
public void Deploy(int laneIndex, float startingVelocity) { gameObject.SetActiveRecursively(true); ResetHead(); control.enabled = true; transform.parent = Static.LevelData.LaneManager.transform; Vector3 lp = Static.LevelData.LaneManager.GetLanePos(laneIndex); transform.localPosition = new Vector3(startingX, lp.y, lp.z + zLaneOffset); currentLaneIndex = laneIndex; currentLane = Static.LevelData.LaneManager.GetLane(laneIndex); velocity = startingVelocity; isDead = false; isSwitchingLanes = false; foreach (var wheel in GetComponentsInChildren<Wheel>()) { wheel.startingVelocity = startingVelocity; } }
private void AddSubLanes(Lane into, LinkedList<Section> sections) { Section prevSection; Section nextSection; for (LinkedListNode<Section> node = sections.First; node != null; node = node.Next) { if(node != sections.First) prevSection = node.Previous.Value; else prevSection = null; if(node != sections.Last) nextSection = node.Next.Value; else nextSection = null; Lane lane = ConvertSection(node.Value, prevSection, nextSection); into.Add(lane); AddSubLanes(lane, node.Value.NestedSections); } }