private void SetupRegion() { Map map = Map.TerMur; for (int x = 390; x < 408; x++) { int z = map.GetAverageZ(x, 3360); if (map.FindItem <Blocker>(new Point3D(x, 3360, z)) == null) { Blocker blocker = new Blocker(); blocker.MoveToWorld(new Point3D(x, 3360, z), map); } } bool any = false; foreach (var m in GetEnumeratedMobiles()) { if (m is BexilPunchingBag && !m.Deleted) { any = true; break; } } if (!any) { BexilPunchingBag bex = new BexilPunchingBag(); bex.MoveToWorld(new Point3D(403, 3391, 38), Map.TerMur); } }
void Awake() { Instance = this; if (Camera.main.aspect >= 1.7) { Screen16x9.SetActive(true); currentRatio = Screen16x9; Screen4x3.SetActive(false); Screen16x10.SetActive(false); } else if (Camera.main.aspect >= 1.5) { Screen16x10.SetActive(true); currentRatio = Screen16x10; Screen16x9.SetActive(false); Screen4x3.SetActive(false); } else { Screen4x3.SetActive(true); currentRatio = Screen4x3; Screen16x9.SetActive(false); Screen16x10.SetActive(false); } float newScale = (transform.localScale.x / 5.2f) * Camera.main.orthographicSize; transform.localScale = new Vector3(newScale, newScale, newScale); }
public void Assign(Blocker blocker, int amount) { var assigned = 0; _distribution.TryGetValue(blocker, out assigned); _distribution[blocker] = assigned + amount; }
public void EqualsTest1() { var blocker = new Blocker(1, 2); Assert.IsTrue(blocker.Equals((ushort)2)); Assert.IsFalse(blocker.Equals((ushort)1)); }
public void PlaceBlockers() { foreach (Rectangle2D rec in Arena.Definition.EffectAreas) { var list = new List <Item>(Arena.Blockers); for (int x = rec.X; x < rec.X + rec.Width; x++) { for (int y = rec.Y; y < rec.Y + rec.Height; y++) { Item blocker; if (list.Count > 0) { blocker = list[0]; list.RemoveAt(0); } else { blocker = new Blocker(); Arena.Blockers.Add(blocker); } blocker.MoveToWorld(new Point3D(x, y, Arena.Definition.Map.GetAverageZ(x, y)), Arena.Definition.Map); } } } }
public ThreadLocalRunner() { blocker = new Blocker(); guard = new SampleThreadLocalCyclicDependencyGuard(blocker); threadStart = new ThreadStart(Run); }
public void Load(Blocker blocker) { if (SavedBlockers.ContainsKey(blocker.PersistenceKey)) { blocker.LoadPersistedObject(SavedBlockers[blocker.PersistenceKey]); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); if (reader.ReadBool()) { m_Blocker = reader.ReadItem() as Blocker; if (m_Blocker != null) { m_Blocker.Delete(); } } if (reader.ReadBool()) { m_LOSBlocker = reader.ReadItem() as LOSBlocker; if (m_LOSBlocker != null) { m_LOSBlocker.Delete(); } } Delete(); }
public void EqualsTest() { var blocker = new Blocker(1, 2); Assert.IsTrue(blocker.Equals(1)); Assert.IsFalse(blocker.Equals(2)); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); Blocker obstacle = (Blocker)target; if (obstacle.m_fluid == null) { EditorGUILayout.HelpBox("Fluid not defined", MessageType.Error); } // Scale obstacle.m_useScaleAsSize = !EditorGUILayout.Toggle("Set Size Manually", !obstacle.m_useScaleAsSize); if (obstacle.m_useScaleAsSize) { EditorGUILayout.HelpBox(" Using global scale as size", MessageType.None); } else { ++EditorGUI.indentLevel; obstacle.m_radius = EditorGUILayout.Slider("Radius", obstacle.m_radius, 0.0f, 5.0f); --EditorGUI.indentLevel; } // Debug m_debug = EditorGUILayout.Foldout(m_debug, "Debug"); if (m_debug) { ++EditorGUI.indentLevel; obstacle.m_showGizmo = EditorGUILayout.Toggle("Draw Gizmo", obstacle.m_showGizmo); --EditorGUI.indentLevel; } EditorUtility.SetDirty(obstacle); }
/// <summary> /// Missing knowledge is guessed or searched in agent's databases /// The worker possibly complete the task incorrectly /// and learn by doing /// </summary> /// <param name="task"></param> /// <param name="knowledgeId"></param> /// <param name="knowledgeBit"></param> /// <param name="blocker"></param> /// <param name="resolution">guessing or searched</param> public void RecoverBlockerIncompleteKnowledgeByGuessing(SymuTask task, Blocker blocker, IAgentId knowledgeId, byte knowledgeBit, BlockerResolution resolution) { if (task is null) { throw new ArgumentNullException(nameof(task)); } RecoverBlockerIncompleteByGuessing(task, blocker, Environment.MainOrganization.Murphies.IncompleteKnowledge, resolution); if (task.Incorrectness == ImpactLevel.Blocked) { return; } LearningModel.LearnByDoing(knowledgeId, knowledgeBit, Schedule.Step); switch (blocker) { // No blocker, it's a required knowledgeBit case null: task.KnowledgesBits.RemoveFirstRequired(knowledgeId); // Blockers Management - no blocker has been created break; // blocker, it's a mandatory knowledgeBit default: task.KnowledgesBits.RemoveFirstMandatory(knowledgeId); break; } }
/// <summary> /// Missing belief is guessed /// The worker possibly complete the task incorrectly /// and learn by doing /// </summary> /// <param name="task"></param> /// <param name="blocker"></param> public void RecoverBlockerIncompleteBeliefByGuessing(SymuTask task, Blocker blocker) { if (task is null) { throw new ArgumentNullException(nameof(task)); } if (blocker == null) { throw new ArgumentNullException(nameof(blocker)); } RecoverBlockerIncompleteByGuessing(task, blocker, Environment.MainOrganization.Murphies.IncompleteBelief, BlockerResolution.Guessing); if (task.Incorrectness == ImpactLevel.Blocked) { return; } var knowledgeId = (IAgentId)blocker.Parameter; var beliefBit = (byte)blocker.Parameter2; var beliefId = BeliefsModel.GetBeliefIdFromKnowledgeId(knowledgeId); InfluenceModel.ReinforcementByDoing(beliefId, beliefBit, Cognitive.KnowledgeAndBeliefs.DefaultBeliefLevel); }
/// <summary> /// Missing belief is guessed /// The worker possibly complete the task incorrectly /// and learn by doing /// </summary> /// <param name="task"></param> /// <param name="blocker"></param> /// <param name="murphy"></param> /// <param name="resolution"></param> public void RecoverBlockerIncompleteByGuessing(SymuTask task, Blocker blocker, MurphyIncomplete murphy, BlockerResolution resolution) { if (task is null) { throw new ArgumentNullException(nameof(task)); } if (murphy == null) { throw new ArgumentNullException(nameof(murphy)); } var impact = murphy.NextGuess(); if (impact > task.Incorrectness) { task.Incorrectness = impact; } if (task.Incorrectness == ImpactLevel.Blocked) { //Agent decide to cancel the task TaskProcessor.Cancel(task); } else { task.Weight *= murphy.NextImpactOnTimeSpent(); if (blocker != null) { task.Recover(blocker, resolution); } } }
/// <summary> /// Launch a recovery for the blocker /// </summary> /// <param name="task"></param> /// <param name="blocker"></param> protected virtual void TryRecoverBlocker(SymuTask task, Blocker blocker) { if (task == null) { throw new ArgumentNullException(nameof(task)); } if (blocker is null) { throw new ArgumentNullException(nameof(blocker)); } if (!task.IsAssigned) { return; } switch (blocker.Type) { case Murphy.IncompleteKnowledge: TryRecoverBlockerIncompleteKnowledge(task, blocker); break; case Murphy.IncompleteBelief: TryRecoverBlockerIncompleteBelief(task, blocker); break; case Murphy.IncompleteInformation: TryRecoverBlockerIncompleteInformation(task, blocker); break; } }
public void OnWindowClosing(object sender, CancelEventArgs e) { if (Blocker.IsBlocked() || !closingAllowed) { e.Cancel = true; } }
public void UpdateTest() { var blocker = new Blocker(0, 0); blocker.Update(1); Assert.AreEqual(1, blocker.LastRecoverStep); Assert.AreEqual(0, blocker.InitialStep); }
public void BlockerTest() { var blocker = new Blocker(1, 2); Assert.AreEqual(1, blocker.Type); Assert.AreEqual(2, blocker.InitialStep); Assert.AreEqual(2, blocker.LastRecoverStep); }
public void RemoveStatusEffect() { StatusEffect = null; Blocker = new Blocker() { UnusablePlay = true, UnusableSkill = true }; }
// Use this for initialization void Start() { if (!_instance) { _instance = this; } DontDestroyOnLoad(this); }
// Collision with a blocker void OnCollisionEnter(Collision collision) { isAlive = false; Blocker blocker = collision.gameObject.GetComponent <Blocker>(); blocker.Explode(); Explode(); }
public void EnterTitle() { state = State.TITLE; player.Init(); Blocker.RemoveAll(); spawner.Reset(); Score.SetScore(0); }
public IEnumerator Move(Blocker blocker, bool prediction, Vector2Int dir, int repeats) { blocker.count++; dir = DirectionRelative(dir, Direction); for (int i = 0; i < repeats; i++) { Vector2Int newIndex = Index + dir; if (Grid.IsOutOfBoundaries(newIndex) || Grid.Instance.TileAt(newIndex).type == TileType.Wall) { if (!prediction) { TryMoveAnimation(dir, 0.2f); yield return(new WaitForSeconds(0.2f)); yield return(new WaitForSeconds(0.1f)); } continue; } Agent otherAgent = OtherAgentOnTile(this, newIndex); if (otherAgent != null && !otherAgent.GetPushed(dir, prediction)) { if (!prediction) { TryMoveAnimation(dir, 0.2f); yield return(new WaitForSeconds(0.2f)); yield return(new WaitForSeconds(0.2f)); } continue; } Tile tile = Grid.Instance.TileAt(newIndex); Vector3 newPosition = Vector3.right * (dir.x + Index.x) + Vector3.up * (dir.y + Index.y); Index += dir; if (!prediction) { tweenId = DoMove(newPosition); yield return(new WaitForSeconds(moveTime)); } if (tile.type == TileType.Goal) { tile.SetIsTouched(true); } if (tile.type == TileType.Death) { Die(prediction); break; } } blocker.count--; }
public ObservableCollection(IEnumerable <T> collection) { this._monitor = new Blocker <T>(); if (collection == null) { throw new ArgumentNullException("collection"); } this.CopyFrom(collection); }
private void CloseWindow(ICloseable window) { Blocker.TurnOffRepeatAlarm(); closingAllowed = true; if (window != null) { window.Close(); } }
public Status(CharacterBase owner) { Owner = owner; Blocker = new Blocker() { UnusablePlay = false, UnusableSkill = false }; StatusEffect = null; }
/// <summary> /// Return allocated consumable units back to the /// <see cref="Consumable"/> in the event the /// <see cref="ProxyDesTaskDesTask{T}.Client"/> is canceled or the event /// that runs the <see cref="ProxyDesTaskDesTask{T}.Client"/> is canceled. /// </summary> /// <remarks> /// This method is used as a <see cref="DeferredDataCallback"/> /// delegate. The delegate is allocated by the /// <see cref="Consumable.RemoveUnits"/> method. /// </remarks> /// <param name="evt"> /// The <see cref="ActivationEvent"/> making the data request. /// </param> /// <returns>Always returns <see langword="null"/>.</returns> internal object ReturnUnits(ActivationEvent evt) { if (!evt.IsPending) { Blocker.AddUnits(_quantity); } return(null); }
public int this[Blocker blocker] { get { var assigned = 0; _distribution.TryGetValue(blocker, out assigned); return assigned; } }
void Start() { if (TheBlocker == null) { TheBlocker = GetComponent <Blocker>(); } TheBlocker.Register(this); }
public void Update(GameTime gameTime, SpriteBatch spriteBatch) { time += gameTime.ElapsedGameTime; Camera.CameraInput(); WorldObjects.Update(gameTime); GenerateWorms(); foreach (var worm in Worms) { worm.Update(gameTime, Camera.CameraPos); worm.WorldObjectCollision(WorldObjects.donkeyRec); if (RectangleCollision.PixelIntersect(worm.WormRectangle, worm.textureData, WorldObjects.donkeyRec, WorldObjects.textureData)) { Console.WriteLine("Touched"); } //Tilemap Collision foreach (var tile in Map.CollisionList) { //if (worm.BreakingAnimation.IsDead) // tile.TileActive = false; if (tile.tileActive) { worm.Collision(spriteBatch, gameTime, tile.TileRectangle, tile); } //if (WeldingActive) //{ // tile.WeldTile(); // WeldingActive = false; //} } //Blocker Collision if (worm.state == Worm.wormState.Blocking) { foreach (var Blocker in Worms) { if (Blocker.state == Worm.wormState.Walking) { Blocker.BlockerCollision(worm.WormRectangle, worm.DirectionRight); } } } //Bouncer Collision if (worm.state == Worm.wormState.Bouncing) { foreach (var Bouncer in Worms) { if (Bouncer.state == Worm.wormState.Walking) { Bouncer.BouncerCollision(worm.WormRectangle, worm.DirectionRight); } } } } }
public int this[Blocker blocker] { get { var assigned = 0; _distribution.TryGetValue(blocker, out assigned); return(assigned); } }
public static void SetBlock(Blocker b, bool value) { if (value) { blocks |= b; } else { blocks &= ~b; } }
void OnTriggerEnter2D(Collider2D other) { Enemy enemy = other.GetComponent<Enemy>(); if(!enemy) return; Blocker blocker = enemy.GetComponent<Blocker>(); Victim victim = other.GetComponent<Victim>(); if (type == types.ALARM) { if (character.hero.state == Hero.states.JUMP) return; if (character.powerupManager.type == PowerupManager.types.MOTO) return; if (enemy.laneId != Game.Instance.gameManager.characterManager.lanes.laneActiveID) return; if (other.GetComponent<Coins>()) return; if (other.GetComponent<PowerUp>()) return; Events.OnOooops(true); alarmOn = true; return; } else if (type == types.GIL_POWERUP) { if (victim && !victim.loopStealing) victim.StealLoop_Gil(); } else if (type == types.GUN && victim != null) { enemy.Explote(); return; } else if (type == types.CENTER) { if (blocker) { if (character.hero.state != Hero.states.DEAD) { if (character.hero.state == Hero.states.JUMP) return; if (character.powerupManager.type == PowerupManager.types.MOTO) { character.CantMoveUp = false; character.CantMoveDown = false; Events.OnHeroPowerUpOff(); return; } else { Events.OnHeroDie(); } } return; } character.OnCollisionCenter(enemy); } else { if (!blocker) return; lastBlocker = blocker; character.OnCollisionWithBlocker(blocker, type); } }
public BlockerJoinedCombatEvent(Blocker blocker, Attacker attacker) { Blocker = blocker; Attacker = attacker; }
public SampleThreadLocalCyclicDependencyGuard(Blocker blocker) { this.blocker = blocker; }
public BlockerAssignment(Blocker blocker) { Blocker = blocker; }
public int this[Blocker blocker] { get { return _assignmentOrder[blocker]; } }
public BlockerDamageAssignment(Blocker blocker) { Blocker = blocker; }
public void Assign(Blocker blocker, int order) { _assignmentOrder[blocker] = order; }
/// <summary> /// Konstruktor /// </summary> /// <param name="spielFeld">Spielfeld als Textzeilen</param> public SokoWahn_3rd(string spielFeld) { SokowahnStaticTools.SpielfeldEinlesen(spielFeld, out feldBreite, out feldHöhe, out startSpielerPos, out feldData, out feldLeer); var spielerRaum = SokowahnStaticTools.SpielfeldRaumScan(feldData, feldBreite); #region # // --- SokowahnRaum-Indexe und deren Felder erstellen --- raumAnzahl = spielerRaum.Where(x => x).Count(); // Anzahl der SokowahnRaum-Felder zählen (Felder, welche theoretisch begehbar sind) raumZuFeld = spielerRaum.Select((c, i) => new { c, i }).Where(x => x.c).Select(x => x.i).ToArray(); raumLinks = raumZuFeld.Select(i => spielerRaum[i - 1] ? raumZuFeld.ToList().IndexOf(i - 1) : -1).ToArray(); raumRechts = raumZuFeld.Select(i => spielerRaum[i + 1] ? raumZuFeld.ToList().IndexOf(i + 1) : -1).ToArray(); raumOben = raumZuFeld.Select(i => spielerRaum[i - feldBreite] ? raumZuFeld.ToList().IndexOf(i - feldBreite) : -1).ToArray(); raumUnten = raumZuFeld.Select(i => spielerRaum[i + feldBreite] ? raumZuFeld.ToList().IndexOf(i + feldBreite) : -1).ToArray(); feldZuRaum = Enumerable.Range(0, feldBreite * feldHöhe).Select(i => spielerRaum[i] ? raumZuFeld.ToList().IndexOf(i) : -1).ToArray(); raumZiel = raumZuFeld.Select(i => feldLeer[i] == '.' ? 1 : 0).ToArray(); raumBlocker = new Blocker[0]; #endregion }