// SUPER BUMP void ActivateBumpBoost(Player p) { GameObject.Find("Console").GetComponent <Console>().UseConsole("Player " + p.id + " has acquired sensitive information. Bump boost enabled."); Bump bump = p.transform.GetComponentInChildren <Bump>(); bump.superBump = true; }
static ProjectedGameState GetNextGameStateFromMove(ScenarioState lastState, EntityData entity, Direction move) { ScenarioState newState = lastState.DeepCopy(); newState.lastGameState = lastState; EntityData entityCopy = newState.GetAllEntities().Find(e => entity.ID == e.ID); Tile currentEntityTile = BoardController.CurrentBoard.GetTileAtPosition(entityCopy.Position); Action stateAction = new Action(GenericMovementCard, entity, move, 1); // If entity can't move that direction, return state as-is. if (!currentEntityTile.ConnectsToNeighbor(move)) { return(new ProjectedGameState(entityCopy, newState, stateAction)); } Tile nextTile = currentEntityTile.GetDirectionalNeighbor(move); // If tile is empty, move entity there and return. if (!newState.IsTileOccupied(nextTile)) { entityCopy.SetPosition(nextTile.Position, newState); return(new ProjectedGameState(entityCopy, newState, stateAction)); } EntityData tileOccupant = newState.GetTileOccupant(nextTile.Position); ResolveBump(entity, tileOccupant, move, newState); Bump bump = new Bump(entityCopy, tileOccupant); return(new ProjectedGameState(entityCopy, newState, stateAction, bump)); }
/// <summary> /// Bump the page split index from zero to one to avoid infinite /// overflow when the first line is too large to fit on the /// page. /// </summary> public override Bump BumpPageSplitIndex() { // For most layouts the index to bump from is zero, but in a table // the zero-th row is the first one after any header rows int bumpFrom = _headerRows; if (_subLayouts.Count <= bumpFrom) { return(Bump.Impossible); } if (_pageSplitIndex > bumpFrom) { return(Bump.Unnecessary); } Layout splitLayout = _subLayouts[_pageSplitIndex]; Bump bump = splitLayout.BumpPageSplitIndex(); if (bump == Bump.Impossible) { // Not able to bump the sublayout, but maybe we can bump ourself if (_subLayouts.Count > 1) { ++_pageSplitIndex; bump = Bump.Bumped; } } return(bump); }
private void Awake() { rb = GetComponent <Rigidbody>(); bump = GetComponent <Bump>(); //float idealDrag = acceleration / maxVelocity; //rb.drag = idealDrag / (idealDrag * Time.fixedDeltaTime + 1); lastBumpTime = Time.time; }
void ActivateBumpShield(Player p) { GameObject.Find("Console").GetComponent <Console>().UseConsole("Player " + p.id + " has acquired sensitive information. Shield boost enabled."); Bump bump = p.transform.GetComponentInChildren <Bump>(); bump.bumpShield = true; Debug.Log("BumpShield"); StartCoroutine(BumpShieldCoroutine(bumpShieldDuration, p)); }
public void SpawnBump() { // 用物件池管理器取得團塊的複製品 Bump _clone = GameObjectPoolManager.GetUseableObject <Bump>("Bump"); // 這裡先寫死,可以透過GameDataManager.LoadGameData(path)的方式取得靜態資料填入 // 也可以透過GameResourceManager.LoadResource(path)的方式取得ScriptableObject取得靜態資料填入 _clone.transform.position = new Vector3(Random.Range(-10f, 10f), Random.Range(-10f, 10f)); _clone.transform.localScale = Vector3.one; }
/// <summary> /// The constructor. /// </summary> public Sensors(Robot _robot) : base(_robot) { Bumps = new Bump(_robot); Wheeldrops = new Wheeldrop(_robot); Cliffs = new Cliff(_robot); MotorOvercurrents = new MotorOvercurrent(_robot); DirtDetectors = new DirtDetector(_robot); Buttons = new Button(_robot); }
private void Awake() { rb = GetComponent <Rigidbody>(); bump = GetComponentInChildren <Bump>(); //float idealDrag = acceleration / maxVelocity; //rb.drag = idealDrag / (idealDrag * Time.fixedDeltaTime + 1); lastBumpTime = Time.time - bumpCoolDown - 1f; basicAcceleration = acceleration; originalColor = cooldown1.GetComponent <MeshRenderer>().materials[1].GetColor("_EmissionColor"); }
private Component GetBumperPosition(CompTimePair nextCTP) { Vector2 cPos = StaticData.EngineManager.CookieRB.PositionXNACenter2D; int cX = (int)cPos.X; int cY = (int)cPos.Y; Component cAdd = new Rope(0, 0, 100); Vector3 vel = StaticData.EngineManager.CookieRB.GetVelocity(); int dir = 0; if (!_isDirRandomized) { dir = Int32.Parse(nextCTP.Args[1]); } else { dir = _rand.Next(4); } int defX = cX - (int)StaticData.BumpHalfSize.X; int defY = cY - (int)StaticData.BumpHalfSize.Y; int X = 0, Y = 0; int diffS = 20; int diff = 35; int diffYLean = 40; int diffXLean = 40; switch ((Direction)dir) { case Direction.East: X = defX; Y = vel.Y > 0 ? cY - diff : cY + diff; break; case Direction.SouthEast: X = vel.X > 0 ? defX + diffS : defX - diffS; Y = vel.Y > 0 ? cY + diffYLean : cY - diffYLean; break; case Direction.South: X = defX; Y = vel.Y > 0 ? cY + diff : cY - (int)(2 * StaticData.BumpHalfSize.Y) - diff; break; case Direction.SouthWest: X = vel.X > 0 ? defX + diffS : defX - diffS; Y = vel.Y > 0 ? cY + diffYLean : cY - diffYLean; break; default: throw new ArgumentOutOfRangeException(); } cAdd = new Bump(X, Y, (Direction)dir); return(cAdd); }
void createBump() { bumpTimer = bumpCooldown; playSound("bump", bumpMagnitude); if (readyIcon != null) { Destroy(readyIcon); } Vector3 bumpLocation = new Vector3(transform.position.x, -0.6f, transform.position.z); Bump bump = Instantiate(bumpPrefab, bumpLocation, Quaternion.identity); bump.playerNum = playerNum; bump.bumpMagnitude = bumpMagnitude; bump.bumpScale = bumpScale; }
void Start() { lightStart = pLight.intensity; gm = FindObjectOfType <GameManager> (); rb = GetComponent <Rigidbody2D> (); accel = gm.accel; topSpeed = gm.topSpeed; jumpPower = gm.jumpPower; doubleClickThreshold = gm.doubleClickThreshold; numJumps = gm.numJumps; moveDownAccel = gm.moveDownAccel; moveDownTopSpeed = gm.moveDownTopSpeed; chargeRate = gm.chargeRate; maxCharge = gm.maxCharge; bump = GetComponentInChildren <Bump>(); }
public static string NextSemVer(this GitVersion version, Bump bump) { switch (bump) { case Bump.Major: return(string.Format("{0}.0.0", version.Major + 1)); case Bump.Minor: return(string.Format("{0}.{1}.0", version.Major, version.Minor + 1)); case Bump.Patch: return(string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Patch + 1)); default: throw new ArgumentOutOfRangeException(nameof(bump), bump, null); } }
public override int GetHashCode() { return (RGBA.GetHashCode() ^ RepeatU.GetHashCode() ^ RepeatV.GetHashCode() ^ OffsetU.GetHashCode() ^ OffsetV.GetHashCode() ^ Rotation.GetHashCode() ^ Glow.GetHashCode() ^ Bump.GetHashCode() ^ Shiny.GetHashCode() ^ Fullbright.GetHashCode() ^ MediaFlags.GetHashCode() ^ TexMapType.GetHashCode() ^ TextureID.GetHashCode()); }
public void CheckHeroPosition(object sender, EventArgs args) { var nextHeroStep = ((IHero)sender).NextPosition; var stepOnBoarder = Borders.Where(x => x.GetType().Name == "Line").Any(y => ((Line)y).Contains(nextHeroStep)); if (!stepOnBoarder) { Bump?.Invoke(this, new BooleanEventArgs { ok = false }); Draw(); return; } ChangeBorderColor(nextHeroStep); Bump?.Invoke(this, new BooleanEventArgs { ok = true }); }
public void setupPlayer(int i, bool isTitle) { rigidbody = GetComponent <Rigidbody>(); audioSource = GetComponent <AudioSource>(); // bumpReadyIcon = GameManager.Instance.bumpReadyIcon; if (bumpPrefab == null) { bumpPrefab = GameManager.Instance.bumpPrefab; } playerNum = i; playerName = gameObject.name.Replace("(Clone)", ""); // print(playerName); // if(isTitle){ // foreach(Renderer m in GetComponentsInChildren<Renderer>()) // m.material = titleMaterial; //TODO: replace with all white texture rather than material? // playerColor = Color.white;} title = isTitle; getInputDevice(); }
static void AddSteepBump(Offset point, LinkedListNode <Field> currentField, List <Bump> steepBumps) { Field value = currentField.Value; value.steep.far = point; value.steepBump = new Bump() { location = point, parent = value.steepBump }; steepBumps.Add(value.steepBump); // Now look through the list of shallow bumps and see if any of them are below the line. for (Bump currentBump = value.shallowBump; currentBump != null; currentBump = currentBump.parent) { if (value.steep.isBelow(currentBump.location)) { value.steep.near = currentBump.location; } } currentField.Value = value; }
static void AddShallowBump(Offset point, LinkedListNode <Field> currentField, List <Bump> shallowBumps) { Field value = currentField.Value; value.shallow.far = point; value.shallowBump = new Bump() { location = point, parent = value.shallowBump }; shallowBumps.Add(value.shallowBump); Bump currentBump = value.steepBump; while (currentBump != null) { if (value.shallow.isAbove(currentBump.location)) { value.shallow.near = currentBump.location; } currentBump = currentBump.parent; } currentField.Value = value; }
private void SetComponentUsageFromActions(Component component) { if (component is Bump) { Bump b = (Bump)component; foreach (BumpRigid bumpRigid in CollidedBumps) { if (b.X == bumpRigid.PositionXNA.X && b.Y == bumpRigid.PositionXNA.Y) { if (!ComponentsHasActions.Contains(component)) { UsedBumps++; ComponentsHasActions.Add(component); } return; } } } else { List <Action> properActions = GetActionsAccordingToComponent(component); foreach (Action action in properActions) { if (IsActionOnComponent(component, action)) { if (!ComponentsHasActions.Contains(component)) { AddUsedComponent(component); ComponentsHasActions.Add(component); } return; } } } return; }
/// <summary> /// Bump the page split index from zero to one to avoid infinite /// overflow when the first sublayout is too large to fit on the /// page. /// </summary> public override Bump BumpPageSplitIndex() { if (_subLayouts.Count == 0) { return(Bump.Impossible); } // Note that a table row's own page split index is always zero // A table row's sublayouts are arranged horizontally, not vertically, // and so bumping is different here. We bump every cell. List <Bump> bumps = new List <Bump>(); foreach (Layout cell in _subLayouts) { Bump bump = cell.BumpPageSplitIndex(); bumps.Add(bump); } // Return the most serious of the individual cell bump results. For // example, if two cells bumped ok but one was impossible, then // treat that as it being impossible to bump this row. if (bumps.Contains(Bump.Impossible)) { return(Bump.Impossible); } if (bumps.Contains(Bump.Bumped)) { return(Bump.Bumped); } if (bumps.Contains(Bump.Unnecessary)) { return(Bump.Unnecessary); } return(Bump.Unnecessary); }
private PageLayout ApplyPageBreak() { // Collapse any space layouts at the top of the page. Space layouts are // intended to provide space _between_ layouts and thus are not appropriate // at the top of a page. We collapse top space after drafting so that we know // where the space layouts fall on this page, but before applying the next // page break because lower layouts might now fit on this page. CollapseTopSpace(); PageDisposition disposition = AssessPageBreak(_bodyBox); // Avoid infinite overflow. If any layout starts at the top of the page and // is longer than the page, then it will return disposition overflow or split // and its page split index will be zero. Splitting at index zero is the same // thing as overflowing. Overflowing a full page will cause this page to move // all of its content onto a new page, leaving itself empty, and this will lead // to infinite overflow. So just stop the overflow right now. This will give us // an oversized page, but that's better than making a report with an infinite // number of empty pages. (In the current implementation, AssessPageBreak here on // a page layout will never return overflow because SetPageSplitIndex always // converts overflow to split, and then because a page can split it doesn't convert // it back to overflow. But for semantic clarity we still check for overflow here.) if ((disposition == PageDisposition.Overflow) || (disposition == PageDisposition.Split && _pageSplitIndex == 0)) { // If we can split as requested then do so. Otherwise bump the page split // index from zero to one - this will leave the oversized layout on this // page but overflow subsequent layouts to the next. If it's not possible // to bump the index then return an empty page to stop the overflow. Bump bump = BumpPageSplitIndex(); switch (bump) { case Bump.Bumped: case Bump.Unnecessary: // The split index has been moved beyond zero (or was already there) // and so we can now do the normal page break. This may still leave // the oversized layout on this page, but later layouts are moved // to the next page. break; case Bump.Impossible: // Couldn't fix the situation by splitting further down, so // just accept the oversized layout return((PageLayout)ShallowCopy()); } } PageLayout overflow = (PageLayout)DoPageBreak(); // This page now contains only the content that can fit in it. Content // that must be moved to the next page, or a later page, is now contained // in the overflow page. If the overflow page is empty then this is the last // page. // Redraft this page to set the layouts' bottoms so that they can // draw borders correctly, and redraft the new page so that its contents // start at the top of the page. Redraft(_bodyBox.Top); overflow?.Redraft(overflow._bodyBox.Top); return(overflow); }
void addShallowBump(Pos pos, Field currentField) { // First, the far point of shallow is set to the new point. currentField.shallow.far = pos; // Second, we need to add the new bump to the shallow bump list for // future steep bump handling. Bump bump = new Bump(pos, currentField.shallowBump); shallowBumps.Add(bump); currentField.shallowBump = bump; // Now we have too look through the list of steep bumps and see if // any of them are below the line. // If there are, we need to replace near point too. Bump currentBump = currentField.steepBump; while(currentBump != null) { if(currentField.shallow.isAbove(currentBump.pos)) currentField.shallow.near = currentBump.pos; currentBump = currentBump.parent; } }
void addSteepBump(Pos pos, Field currentField) { currentField.steep.far = pos; Bump bump = new Bump(pos, currentField.steepBump); steepBumps.Add(bump); currentField.steepBump = bump; // Now look through the list of shallow bumps and see if any of them // are below the line. Bump currentBump = currentField.shallowBump; while (currentBump != null) { if(currentField.steep.isBelow(currentBump.pos)) currentField.steep.near = currentBump.pos; currentBump = currentBump.parent; } }
public Bump(Pos _pos, Bump _parent) { pos = _pos; parent = _parent; }
public ProjectedGameState(EntityData _activeEntity, ScenarioState _gameState, Action _action, Bump bump) { activeEntity = _activeEntity; scenarioState = _gameState; bumps = new List <Bump>() { bump }; action = _action; attackedPositions = new List <Vector2Int>(); }
private void PlaceNewComp(CompTimePair nextCTP) { CompsScatteredSoFar++; //Shotter.TakeEngineShot(); var fEngine = ObjectSerializer.DeepCopy(StaticData.EngineManager); for (int i = 0; i < 15; i++) { fEngine.Update(new GameTime()); } Vector2 cPossss = StaticData.EngineManager.CookieRB.PositionXNA2D; Vector2 cPos = fEngine.CookieRB.PositionXNA2D; //StaticData.EngineManager.CookieRB.PositionXNACenter2D; int cX = (int)cPos.X; int cY = (int)cPos.Y; Component cAdd = new Rope(0, 0, 100); Vector3 acc = StaticData.EngineManager.CookieRB.GetAcceleration(); switch (nextCTP.CType) { case ComponentType.Cookie: break; case ComponentType.Frog: cAdd = GetFrogPosition(); break; case ComponentType.Blower: cAdd = GetBlowerPosition(nextCTP); break; case ComponentType.Rope: break; case ComponentType.Bubble: cAdd = new Bubble(cX - (int)StaticData.BubbleDimBubble / 2, cY - (int)StaticData.BubbleDimBubble / 2); //GetBubblePosition(); break; case ComponentType.Water: break; case ComponentType.Rocket: int dirR = _rand.Next(8); cAdd = new Rocket(cX - (int)StaticData.RocketCarrierHalfSize.X, cY - (int)StaticData.RocketCarrierHalfSize.Y, (Direction)dirR); //GetRocketPosition(nextCTP); break; case ComponentType.Bump: int dirB = _rand.Next(3); dirB = dirB == 2 ? 3 : dirB; if (dirB == 1 || dirB == 3) { var fEngineB = ObjectSerializer.DeepCopy(StaticData.EngineManager); for (int i = 0; i < 25; i++) { fEngineB.Update(new GameTime()); } cPos = fEngine.CookieRB.PositionXNA2D; cX = (int)cPos.X; cY = (int)cPos.Y; } cAdd = new Bump(cX - (int)StaticData.BumpHalfSize.X, cY - (int)StaticData.BumpHalfSize.Y, (Direction)dirB); //cAdd = GetBumperPosition(nextCTP); break; case ComponentType.Cracker: break; default: throw new ArgumentOutOfRangeException(); } if (!(cAdd is Rope)) { cAdd.AddSelfToEngine(); LevelStr += cAdd.ToString(); } }
void DrawBump(EntityData bumpingEntity, ProjectedGameState projectedState, ProjectedGameState nextState, Bump bump) { Vector2Int positionTwoStatesAgo = projectedState .scenarioState .lastGameState .lastGameState .GetEntityWhere(e => e.ID == bumpingEntity.ID) .Position; Vector2Int positionThisState = bumpingEntity.Position; Vector2Int positionLastState = projectedState .scenarioState .lastGameState .GetEntityWhere(e => e.ID == bumpingEntity.ID) .Position; bool isEntitysFirstMove = positionLastState == positionTwoStatesAgo; bool bumpSucceeds = bumpingEntity.Position != positionLastState; if (bumpSucceeds) { DrawPath_Ending(bumpingEntity, positionLastState, positionThisState); DrawSuccessfulBumpEffect(positionThisState, BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionLastState)); DrawPath_Beginning(bump.bumpedEntity, positionThisState, bump.bumpedEntity.Position); } else if (isEntitysFirstMove) { Vector2Int bumpedEntityPosition = bump.bumpedEntity.Position; Sprite pathSprite = ScenarioImageManager.GetPathSprite(PathType.Beginning); Direction directionOfEntrance = BoardHelperFunctions.GetDirectionFromPosition(bumpedEntityPosition, positionThisState); GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, bumpingEntity.IdentifyingColor); DrawFailedBumpEffect(positionThisState, BoardHelperFunctions.GetDirectionFromPosition(positionThisState, bumpedEntityPosition)); } else { PathType pathType = GetFailedBumpPathType(positionTwoStatesAgo, positionThisState, bump.bumpedEntity.Position); Sprite pathSprite = ScenarioImageManager.GetPathSprite(pathType); Vector2Int bumpedEntityPosition = bump.bumpedEntity.Position; Direction directionOfEntrance = BoardHelperFunctions.GetDirectionFromPosition(positionThisState, positionTwoStatesAgo); GenerateAndPositionCellImage(positionThisState, GetImageRotation(directionOfEntrance), pathSprite, bumpingEntity.IdentifyingColor); DrawFailedBumpEffect(positionThisState, BoardHelperFunctions.GetDirectionFromPosition(positionThisState, bumpedEntityPosition)); } }
public ReleaseInformation(Version version, Bump bump) { Version = version; Bump = bump; }
public override string ToString() => String.Format("Color: {0} RepeatU: {1} RepeatV: {2} OffsetU: {3} OffsetV: {4} " + "Rotation: {5} Bump: {6} Shiny: {7} Fullbright: {8} Mapping: {9} Media: {10} Glow: {11} ID: {12} MaterialID: {13}", TextureColor.ToString(), RepeatU, RepeatV, OffsetU, OffsetV, Rotation, Bump.ToString(), Shiny.ToString(), FullBright, TexMapType.ToString(), MediaFlags, Glow, TextureID.ToString(), MaterialID.ToString());