/// <summary> /// Deletes a specific component from its factory /// If component is drawable or collidable, also unregisters it /// </summary> /// <param name="component">Compoment to remove</param> public void RemoveComponent(IComponent component) { ComponentManager factory; Type t = component.GetType(); //Check if component is drawable -> unregister it IVisible drawable = component as IVisible; if (drawable != null) { renderer.UnregisterDrawble(drawable); } //Check if component is collidable -> unregister it ICollidable collidable = component as ICollidable; if (collidable != null) { collisionManager.UnregisterCollidable(collidable); } //Loops through all the manager to find the component for (int i = 0; i < managersLists.Count; i++) { factory = managersLists[i]; //Removes component from its factory if (factory.factoryType == t) { factory.RemoveComponent(component); break; } } }
public void HandleSingleVisibility(IVisible watcher, IVisible watched, List<IVisible> playerView) { Debug.Assert(watcher.Allegiance == Allegiance.Player); Debug.Assert(watched.Allegiance != Allegiance.Player); if (!watched.GetVisibility().VisibleToPlayer && CanSee(watcher, watched)) SetVisibleToPlayer(watched, playerView); }
public void And_Chains_Correctly() { // Arrange this.underTest = Visible.Only.OnMobile().And.OnDesktop(); // Act var underTestClass = underTest.Class; // Assert underTestClass.Should().NotBeNullOrWhiteSpace(); underTestClass.Split(' ').Should() .HaveCount(5) .And .OnlyHaveUniqueItems() .And .HaveElementAt(0, "flex-show") .And .HaveElementAt(1, "flex-sm-hide") .And .HaveElementAt(2, "flex-md-show") .And .HaveElementAt(3, "flex-lg-hide") .And .HaveElementAt(4, "flex-xl-hide"); }
public virtual IVisible[] AnyObjects(String type, String name) { GetMapObjects(type, name); IVisible[] tmp = new IVisible[_lastObjects.Length]; _lastObjects.CopyTo(tmp, 0); return tmp; }
/// <summary> /// Removes all IComponents from the managers, that belong to a specific entity /// This method is called when an entity is destroyed /// </summary> /// <param name="entityID">UID of the entity owner of the components</param> public void RemoveComponents(int entityID) { ComponentManager manager; IComponent component; //Checks all managers to see where the entity has components associated for (int i = 0; i < managersLists.Count; i++) { manager = managersLists[i]; for (int j = 0; j < manager.components.Count; j++) { component = manager.components[j]; if (component.Owner.UID == entityID) { //Check if component is drawable -> unregister it IVisible drawable = component as IVisible; if (drawable != null) { renderer.UnregisterDrawble(drawable); } //Check if component is collidable -> unregister it ICollidable collidable = component as ICollidable; if (collidable != null) { collisionManager.UnregisterCollidable(collidable); } //When a component associated with the entity is found remove it from the manager manager.components.Remove(component); } } } }
/// <summary> /// Fills in or modifies the given display info for the item</summary> /// <param name="item">Item</param> /// <param name="info">Display info to update</param> public void GetInfo(object item, ItemInfo info) { LayerFolder layer = item.As <LayerFolder>(); if (layer != null) { info.Label = layer.Name; info.HasCheck = true; info.SetCheckState(GetCheckState(layer)); return; } ElementRef reference = item.As <ElementRef>(); if (reference != null) { Element element = reference.Element; if (element != null) { info.Label = element.Id; info.IsLeaf = true; } IVisible iVisible = GetIVisible(item); if (iVisible != null) { info.HasCheck = true; info.Checked = iVisible.Visible; } return; } }
public override void OnBeginDrag() { var selection = DesignView.Context.As <ISelectionContext>().Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); NodeList.Clear(); m_isUniformScaling = false; IEnumerable <DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable <DomNode>()); foreach (DomNode node in rootDomNodes) { ITransformable transNode = node.As <ITransformable>(); if (transNode == null || (transNode.TransformationType & TransformationTypes.Scale) == 0) { continue; } IVisible vn = node.As <IVisible>(); if (!vn.Visible) { continue; } ILockable lockable = node.As <ILockable>(); if (lockable.IsLocked) { continue; } // force uniform scaling if any node requires it if ((transNode.TransformationType & TransformationTypes.UniformScale) == TransformationTypes.UniformScale) { m_isUniformScaling = true; } NodeList.Add(transNode); IManipulatorNotify notifier = transNode.As <IManipulatorNotify>(); if (notifier != null) { notifier.OnBeginDrag(); } } m_originalValues = new Vec3F[NodeList.Count]; int k = 0; foreach (ITransformable node in NodeList) { m_originalValues[k++] = node.Scale; } if (NodeList.Count > 0) { transactionContext.Begin("Scale".Localize()); } }
public virtual IVisible[] AnyObjects(string type, TestProperty[] properties) { GetMapObjects(type, properties); IVisible[] tmp = new IVisible[_lastObjects.Length]; _lastObjects.CopyTo(tmp, 0); return tmp; }
public void SetUp() { scaleGridToggleBehaviourMock_ = Substitute.For <IToggleButtonBehaviour>(); directionGridToggleBehaviourMock_ = Substitute.For <IToggleButtonBehaviour>(); equatorToggleBehaviourMock_ = Substitute.For <IToggleButtonBehaviour>(); scaleGridToggleButtonMock_ = Substitute.For <IToggleButton>(); directionGridToggleButtonMock_ = Substitute.For <IToggleButton>(); equatorGridToggleButtonMock_ = Substitute.For <IToggleButton>(); consoleBehaviourMock_ = Substitute.For <IConsoleBehaviour>(); gridBehaviourMock_ = Substitute.For <IGridBehaviour>(); componentFactoryMock_ = Substitute.For <IComponentFactory>(); scaleCircleBehaviourMock_ = Substitute.For <IVisible>(); directionCircleBehaviourMock_ = Substitute.For <IVisible>(); equatorCircleBehaviourMock_ = Substitute.For <IVisible>(); pureDataFacadeMock_ = Substitute.For <IPureDataFacade>(); consoleBehaviourMock_.ScaleGridToggleBehaviour.Returns(scaleGridToggleBehaviourMock_); consoleBehaviourMock_.DirectionGridToggleBehaviour.Returns(directionGridToggleBehaviourMock_); consoleBehaviourMock_.EquatorToggleBehaviour.Returns(equatorToggleBehaviourMock_); componentFactoryMock_.CreateToggleButton(scaleGridToggleBehaviourMock_).Returns(scaleGridToggleButtonMock_); componentFactoryMock_.CreateToggleButton(directionGridToggleBehaviourMock_).Returns(directionGridToggleButtonMock_); componentFactoryMock_.CreateToggleButton(equatorToggleBehaviourMock_).Returns(equatorGridToggleButtonMock_); gridBehaviourMock_.ScaleCircleBehaviour.Returns(scaleCircleBehaviourMock_); gridBehaviourMock_.DirectionCircleBehaviour.Returns(directionCircleBehaviourMock_); gridBehaviourMock_.FFTCircleBehaviour.Returns(equatorCircleBehaviourMock_); console_ = new Console(consoleBehaviourMock_, gridBehaviourMock_, pureDataFacadeMock_, componentFactoryMock_); }
public void GetInfo(object item, ItemInfo info) { ILayer layer = Adapters.As <ILayer>(item); if (layer != null) { info.Label = layer.Name; info.HasCheck = true; info.SetCheckState(GetCheckState(layer)); } else { IReference <IGameObject> reference = Adapters.As <IReference <IGameObject> >(item); if (reference != null) { IListable listable = reference.As <IListable>(); listable.GetInfo(info); //INameable nameable = Adapters.As<INameable>(reference.Target); //if (nameable != null && !string.IsNullOrEmpty(nameable.Name)) // info.Label = nameable.Name; info.IsLeaf = true; IVisible iVisible = GetIVisible(item); if (iVisible != null) { info.HasCheck = true; info.Checked = iVisible.Visible; } } } }
public bool CanSeeItemOfInterest(IItemOfInterest itemOfInterest, bool requireFieldOfView) { //if it's a visible item //we'll want to access its visibility modifiers IVisible mVisibleItemCheck = (IVisible)itemOfInterest; if (mVisibleItemCheck != null) { return(CanSeeVisibleItem(mVisibleItemCheck, requireFieldOfView)); } //otherwise we'll just check the item without multipliers //we calculate this every time because it could change due to external modifiers float mAwarenessDistance = Looker.AwarenessDistanceTypeToVisibleDistance(State.AwarenessDistance); if (State.ManualAwarenessDistance > 0) { mAwarenessDistance = State.ManualAwarenessDistance; } if (Looker.IsInVisibleRange(worlditem.Position, itemOfInterest.Position, mAwarenessDistance)) { if (!requireFieldOfView || Looker.IsInFieldOfView(worlditem.tr.forward, worlditem.Position, State.FieldOfView, itemOfInterest.Position)) { //it's in our field of view AND it's close enough to see //check to see if we can see it with the visible item's modifiers in place return(true); } } return(false); }
public void OnFullHDAndSmaller_SetsValue_Correctly() { // Arrange this.underTest = Visible.Only.OnFullHDAndSmaller(); // Act var underTestClass = underTest.Class; // Assert underTestClass.Should().NotBeNullOrWhiteSpace(); underTestClass.Split(' ').Should() .HaveCount(5) .And .OnlyHaveUniqueItems() .And .HaveElementAt(0, "flex-show") .And .HaveElementAt(1, "flex-sm-show") .And .HaveElementAt(2, "flex-md-show") .And .HaveElementAt(3, "flex-lg-show") .And .HaveElementAt(4, "flex-xl-show"); }
public override void OnBeginDrag() { if (m_hitRegion == HitRegion.None) { return; } var selectionCntx = DesignView.Context.As <ISelectionContext>(); var selection = selectionCntx.Selection; var transactionContext = DesignView.Context.As <ITransactionContext>(); NodeList.Clear(); IEnumerable <DomNode> rootDomNodes = DomNode.GetRoots(selection.AsIEnumerable <DomNode>()); foreach (DomNode domNode in rootDomNodes) { ITransformable node = domNode.As <ITransformable>(); if (node == null || (node.TransformationType & TransformationTypes.Rotation) == 0) { continue; } IVisible vn = node.As <IVisible>(); if (!vn.Visible) { continue; } ILockable lockable = node.As <ILockable>(); if (lockable.IsLocked) { continue; } NodeList.Add(node); IManipulatorNotify notifier = node.As <IManipulatorNotify>(); if (notifier != null) { notifier.OnBeginDrag(); } } m_rotations = new Matrix4F[NodeList.Count]; for (int k = 0; k < NodeList.Count; k++) { ITransformable node = NodeList[k]; Matrix4F m = new Matrix4F(node.Transform); m.Translation = new Vec3F(0, 0, 0); m.Normalize(m); m_rotations[k] = m; } if (NodeList.Count > 0) { transactionContext.Begin("Rotate".Localize()); } }
public override void Release() { ObservedCreature = null; Inventory.Release(); Inventory = null; PlayerData = null; try { Visible.Stop(); Visible.Release(); } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { //Already stoped } Visible = null; Skills = null; Quests = null; if (CurrentDialog != null) { CurrentDialog.Release(); } if (Pet != null) { Pet.Release(); } Pet = null; MarkedCreatures = null; TeleportLoadMapEvent = null; try { SystemWindowsTimer.Stop(); SystemWindowsTimer.Dispose(); } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } SystemWindowsTimer = null; BlockersInChat = null; Friends = null; base.Release(); }
/// <summary> /// Post operation /// </summary> /// <param name="visible">Visible object</param> void IVisibleConsumer.Post(IVisible visible) { if (visible is ICameraConsumer) { (visible as ICameraConsumer).Add(this); onPost(visible); } }
public static bool IsMainEntity(IVisible visible) { if (visible == null) { return(false); } return(visible.Id == MainEntityId); }
public override object CreateForm(IPosition position, IVisible visible) { if (visible is WpfInterface.Objects3D.DeformedWpfShape) { return(new Forms.FormDeformed(position, visible)); } return(null); }
void IVisibleConsumer.Remove(IVisible visible) { if (visible != null) { RemoveVisible(visible.Position); onRemove(visible); } }
public void AddUnit(IVisible unit) { int x = ((int)unit.Position.X) / mSectorWidth; int y = ((int)unit.Position.Y) / mSectorHeight; Debug.Assert(!mSectors[x, y].Contains(unit)); mSectors[x, y].Add(unit); UpdateCounters(unit, x, y, +1); }
public void SetVisible(object item, bool value) { IVisible visible = item.As <IVisible>(); if (visible != null) { visible.Visible = value; } }
public PlayerOrTribeRow(Tribe tribe) { _visibilityGetter = tribe; Value = tribe.Tag; Text = string.Format(ControlsRes.PlayerOrTribeRow_Text, Tools.Common.GetPrettyNumber(tribe.AllPoints), tribe.Rank); Tooltip = tribe.Tooltip; Rank = tribe.Rank; IsTribe = true; }
private bool _InvalidResource(IVisible visible) { if (EntityData.IsResource(visible.EntityType)) { return(_ActorMind.IsLooted(visible.Id)); } return(false); }
public PlayerOrTribeRow(Player player) { _visibilityGetter = player; Value = player.Name; Text = string.Format(ControlsRes.PlayerOrTribeRow_Text, Tools.Common.GetPrettyNumber(player.Points), player.Rank); Tooltip = player.Tooltip; Rank = player.Rank; IsPlayer = true; }
public Credits(Main main) : base(Vector2.Zero, "Menu") { Main = main; Nom = "Credits"; EnPause = true; EstVisible = false; EnFocus = false; Position += new Vector3(0, 0, 1); Titre = new IVisible("Credits", RainingSundays.Core.Persistance.Facade.recuperer<SpriteFont>("DataControlBold"), Color.White, new Vector3(0, -270, 0), this); Titre.Origine = Titre.Centre; Filtre = new IVisible(RainingSundays.Core.Persistance.Facade.recuperer<Texture2D>("PixelBlanc"), Vector3.Zero, this); Filtre.PrioriteAffichage = 0.85f; Filtre.TailleVecteur = new Vector2(600, 400); Filtre.Couleur = new Color(Color.Black, 200); Filtre.Origine = Filtre.Centre; TitrePersonne = new List<KeyValuePair<IVisible, IVisible>>(); SpriteFont police = RainingSundays.Core.Persistance.Facade.recuperer<SpriteFont>("DataControlMini"); TitrePersonne.Add(new KeyValuePair<IVisible, IVisible>( new IVisible("Game designer & programmer", police, Color.White, new Vector3(-270, -100, 0), this), new IVisible("Jodi Giordano", police, Color.White, new Vector3(100, -100, 0), this))); TitrePersonne.Add(new KeyValuePair<IVisible,IVisible>( new IVisible("Sound designer", police, Color.White, new Vector3(-270, -180, 0), this), new IVisible("Olivier Robert", police, Color.White, new Vector3(100, -180, 0), this))); TitrePersonne.Add(new KeyValuePair<IVisible, IVisible>( new IVisible("Visual designer", police, Color.White, new Vector3(-270, -140, 0), this), new IVisible("Bruno Durand", police, Color.White, new Vector3(100, -140, 0), this))); TitrePersonne.Add(new KeyValuePair<IVisible, IVisible>( new IVisible("Core engine designers", police, Color.White, new Vector3(-270, -60, 0), this), new IVisible("Jodi Giordano", police, Color.White, new Vector3(100, -60, 0), this))); TitrePersonne.Add(new KeyValuePair<IVisible, IVisible>( new IVisible("", police, Color.White, new Vector3(-270, -40, 0), this), new IVisible("Julien Theron", police, Color.White, new Vector3(100, -40, 0), this))); TitreRemerciements = new IVisible("Thanks to:", police, Color.White, new Vector3(-270, 40, 0), this); Remerciements = new List<IVisible>(); Remerciements.Add(new IVisible("- Francois Pomerleau for his idea of a constantly moving path", police, Color.White, new Vector3(-270, 80, 0), this)); Remerciements.Add(new IVisible("- The beautiful Farseer Physics Engine (farseerphysics.codeplex.com)", police, Color.White, new Vector3(-270, 100, 0), this)); Remerciements.Add(new IVisible("- The crazy Mercury Particle Engine (mpe.codeplex.com)", police, Color.White, new Vector3(-270, 120, 0), this)); Remerciements.Add(new IVisible("- The useful XNA Console (xnaconsole.codeplex.com)", police, Color.White, new Vector3(-270, 140, 0), this)); Retour = new IVisible("Press B to return to the menu", police, Color.White, new Vector3(0, 200, 0), this); Retour.Origine = Retour.Centre; Retour.PrioriteAffichage = 0.1f; }
public FormDeformed(IPosition p, IVisible v) : this() { userControlDeformed.Set(p, v); IAssociatedObject ao = p as IAssociatedObject; label = ao.Object as IObjectLabel; UpdateFormUI(); }
private void _Remove(IVisible visible) { Entity actor; if (_Actors.TryGetValue(visible.Id, out actor)) { GameObject.Destroy(actor.Avatar.gameObject); _Actors.Remove(visible.Id); } }
/* * private void Start() * { * _thisMotor = gameObject.GetComponent<IMotor>(); * _thisVisible = gameObject.GetComponent<IVisible>(); * _lastDistance = _thisVisible.GetDistanceVisible(); * _lastAngle = _thisVisible.GetAngleVisible(); * } */ public FindAngry(Transform transform, IMotor motor, IVisible visible, float distanceFind) { _thisTransform = transform; _thisMotor = motor; _thisVisible = visible; this.distanceFind = distanceFind; _lastDistance = _thisVisible.GetDistanceVisible(); _lastAngle = _thisVisible.GetAngleVisible(); }
private CheckState GetCheckState(ILayer layer) { bool hasUncheckedChild = false; bool hasCheckedChild = false; foreach (ILayer subLayer in layer.Layers) { CheckState subCheckState = GetCheckState(subLayer); switch (subCheckState) { case CheckState.Checked: hasCheckedChild = true; break; case CheckState.Unchecked: hasUncheckedChild = true; break; case CheckState.Indeterminate: hasCheckedChild = true; hasUncheckedChild = true; break; } } if (!hasCheckedChild || !hasUncheckedChild) { foreach (IGameObject gameObject in layer.GetGameObjects()) { IVisible iVisible = gameObject.As <IVisible>(); if (iVisible != null) { if (iVisible.Visible) { hasCheckedChild = true; } else { hasUncheckedChild = true; } } } } if (hasCheckedChild && !hasUncheckedChild) { return(CheckState.Checked); } if (hasUncheckedChild && !hasCheckedChild) { return(CheckState.Unchecked); } return(CheckState.Indeterminate); }
private void _CreateEntity(IVisible obj) { GameObject source; if (_EntitySources.TryGetValue(obj.EntityType, out source)) { var entityObject = GameObject.Instantiate(source); var entity = entityObject.GetComponent <Entity>(); entity.SetVisible(obj); } }
public bool IsVisible(object item) { IVisible visible = item.As <IVisible>(); if (visible != null) { return(visible.Visible); } return(false); }
private void _CreateEntity(IVisible obj) { GameObject source; if (_EntitySources.TryGetValue(obj.EntityType, out source)) { var entityObject = GameObject.Instantiate(source); var entity = entityObject.GetComponent<Entity>(); entity.SetVisible(obj); } }
private void _SetIndividual(IVisible obj) { _DebugJoinCount++; if (_FieldOfVision.FindAll((v) => v.Id == obj.Id).Any()) { _DebugRejoinCount++; return; } _FieldOfVision.Add(obj); obj.TalkMessageEvent += _TalkMessage; }
private IEnumerator DisableControllerWhenHidden(float tickDuration, IVisible controller) { while (true) { if (!(controller.CheckVisibilityChanges())) { break; } yield return(new WaitForSeconds(tickDuration)); } ((MonoBehaviour)controller).gameObject.SetActive(false); }
private void _DestroyEntity(IVisible obj) { if (_Visible == null) { return; } if (obj.Id == _Visible.Id) { _ClearCamera(); GameObject.Destroy(gameObject); } }
private void _Add(IVisible visible) { if (_Walls.ContainsKey(visible.Id) == false) { if (EntityData.IsWall(visible.EntityType)) { var obj = this.Map.Add(visible); _Walls.Add(visible.Id, new Entity() { Visible = visible, Avatar = obj }); } if (EntityData.IsActor(visible.EntityType)) { var obj = this.Map.Add(visible); _Actors.Add(visible.Id, new Entity() { Visible = visible, Avatar = obj }); } } }
public void SetContainedObject(IRenderable containedObject) { if (containedObject == this) { throw new ArgumentException("The argument containedObject cannot be 'this'"); } mContainedObjectAsIpso = containedObject as IRenderableIpso; mContainedObjectAsIVisible = containedObject as IVisible; if (containedObject is global::RenderingLibrary.Math.Geometry.LineRectangle) { // All elements use line rectangles to draw themselves, but we don't // want them to show up in runtime (usually). We have a LocalVisible bool // which can be set to false to prevent the rectangles from drawing. // Update: We used to only set the LocalVisible if the object was a container, // but elements also inherit from container. We could check the base type, but then // elements that inherit from other elements would still show up. We'll ignore the element // name and just set LineRectangles to invisible if we're dealing with elements, no matter what. //if (this.ElementSave != null && ElementSave.Name == "Container") if (this.ElementSave != null) { (containedObject as global::RenderingLibrary.Math.Geometry.LineRectangle).LocalVisible = ShowLineRectangles; } } UpdateLayout(); }
private void SetVisibleToComputer(IVisible unit, List<IVisible> computerView) { //Debug.Assert(!computerView.Contains(unit)); unit.GetVisibility().VisibleToComputer = true; computerView.Add(unit); }
private string FormatVisibility(IVisible visibleProperty) { return (visibleProperty.visible) ? "XXXXX" : "------"; }
private void _DestroyEntity(IVisible obj) { if (_Visible == null) return; if (obj.Id == _Visible.Id) { _ClearCamera(); GameObject.Destroy(gameObject); } }
public static bool IsMainEntity(IVisible visible) { if (visible == null) return false; return visible.Id == MainEntityId; }
public Visibility(IVisible owner) { mOwner = owner; }
private void UpdateCounters(IVisible unit, Allegiance unitAllegiance, int x, int y, int addOrRemove) { if (unitAllegiance == Allegiance.Player) { mPlayerCount[x, y]++; if (unit is ISpaceship) mPlayerShipCount[x, y] += addOrRemove; else if (unit is DeathStar) mPlayerDsCount[x, y] += addOrRemove; } else if (unitAllegiance == Allegiance.Computer) { mComputerCount[x, y]++; if (unit is ISpaceship) mComputerShipCount[x, y] += addOrRemove; else if (unit is DeathStar) mComputerDsCount[x, y] += addOrRemove; } }
public override void Release() { ObservedCreature = null; Inventory.Release(); Inventory = null; PlayerData = null; try { Visible.Stop(); Visible.Release(); } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { //Already stoped } Visible = null; Skills = null; Quests = null; if (CurrentDialog != null) CurrentDialog.Release(); if (Pet != null) Pet.Release(); Pet = null; MarkedCreatures = null; TeleportLoadMapEvent = null; try { SystemWindowsTimer.Stop(); SystemWindowsTimer.Dispose(); } // ReSharper disable EmptyGeneralCatchClause catch // ReSharper restore EmptyGeneralCatchClause { } SystemWindowsTimer = null; BlockersInChat = null; Friends = null; base.Release(); }
public void UpdateUnit(IVisible unit, Vector2 newPos) { int x = ((int)unit.Position.X) / mSectorWidth; int y = ((int)unit.Position.Y) / mSectorHeight; int x2 = ((int)newPos.X) / mSectorWidth; int y2 = ((int)newPos.Y) / mSectorHeight; if (x != x2 || y != y2) { mSectors[x, y].Remove(unit); UpdateCounters(unit, x, y, -1); mSectors[x2, y2].Add(unit); UpdateCounters(unit, x2, y2, +1); } }
private void _Remove(IVisible visible) { Entity actor; if (_Actors.TryGetValue(visible.Id , out actor)) { GameObject.Destroy(actor.Avatar.gameObject); _Actors.Remove(visible.Id); } }
private bool _InvalidResource(IVisible visible) { if (EntityData.IsResource(visible.EntityType)) return _ActorMind.IsLooted(visible.Id) ; return false; }
private void _ClearIndividual(IVisible obj) { _DebugLeftCount ++; _FieldOfVision.RemoveAll( i => { if (i.Id == obj.Id) { _DebugRealLeftCount ++; obj.TalkMessageEvent -= _TalkMessage; return true; } return false; } ); }
private static Polygon _BuildMesh(IVisible visible) { var data = Resource.Instance.FindEntity(visible.EntityType); var mesh = data.Mesh.Clone(); mesh.Offset(visible.Position); if (data.CollisionRotation) { mesh.RotationByDegree(visible.Direction); } return mesh; }
private void UpdateCounters(IVisible unit, int sectorX, int sectorY, int addOrRemove) { UpdateCounters(unit, unit.Allegiance, sectorX, sectorY, addOrRemove); }
private void _RemoveChater(IVisible obj) { obj.TalkMessageEvent -= _PushMessage; }
public void AllegianceChanged(IVisible unit, Allegiance newAllegiance) { Point sector = GetSector(unit.Position); UpdateCounters(unit, sector.X, sector.Y, -1); UpdateCounters(unit, newAllegiance, sector.X, sector.Y, +1); }
public MapEntity Add(IVisible visible) { return _Add(new Vector2(visible.Position.X, visible.Position.Y), visible.Direction, visible.EntityType); }
public void SetVisible(Regulus.Project.ItIsNotAGame1.Data.IVisible visible) { if(_Visible != null) throw new Exception("重複設定."); _Visible = visible; _Visible.StatusEvent += _Move; _Visible.TalkMessageEvent += _ShowMessage; _Visible.EnergyEvent += _ShowEnergy; _Visible.QueryStatus(); _SetStatus(_Visible.Status); _SetPosition(_Visible.Position); _SetDirection(_Visible.Direction); _SetCamera(); _SetAvatarEquipments(); }
private void _AddChater(IVisible obj) { obj.TalkMessageEvent += _PushMessage; }
public ShowOrHideSingleObjectCommand(IVisible visibleObject, MessageSystem messageSystem) { _visibleObject = visibleObject; _messageSystem = messageSystem; }
public void SetId(IVisible visible ) { _Visible = visible; _Visible.EquipEvent += _UpdateAvatar; }
public VisibilityChangedEvent(IVisible visibleObject) { _visibleObject = visibleObject; }
private bool CanSee(IVisible watcher, IVisible watched) { if ((watcher.Position - watched.Position).Length() <= watcher.LineOfSight+watched.CollisionRadius) return true; return false; }
private void SetVisibleToPlayer(IVisible unit, List<IVisible> playerView) { //Debug.Assert(!playerView.Contains(unit)); unit.GetVisibility().VisibleToPlayer = true; playerView.Add(unit); }