public void Into(Entity entity) { var ei = new EntityInfomation() { Id = entity.Id, Physical = entity.FindAbility<PhysicalAbility>(), Observe = entity.FindAbility<IObserveAbility>(), Observed = entity.FindAbility<IObservedAbility>(), Move = entity.FindAbility<IMoverAbility>(), Cross = entity.FindAbility<ICrossAbility>() }; _EntityInfomations.Add(ei); if (ei.Physical != null) { _ObseverdInfomations.Insert(ei); } }
private void _UpdateEffect(EntityInfomation entity) { var behavior = entity.Effect; var property = entity.Property; var obs = entity.Observed; CustomType.Rect bounds = new CustomType.Rect(); int skill = 0; if (behavior.TryGetBounds(ref bounds , ref skill)) { var s = GameData.Instance.FindSkill(skill); if (s != null) { if (s.Id == 1) { property.ChangeMode(); behavior.Hit(); } else if (s.Id == 2 ) { var inbrounds = _ObseverdInfomations.Query(bounds); var commanders = from e1 in inbrounds where e1.Id != entity.Id && e1.Commander != null select e1.Commander; foreach (var commander in commanders) { commander.Invoke(new BehaviorCommand.Injury(s.Param1, obs.Direction)); } if (commanders.Count() > 0) { behavior.Hit(); } } } } }
private void _RemoveObserve(EntityInfomation info) { _Observes.Remove(i => i.Id == info.Id); }
void _Into(Entity entity) { var ei = new EntityInfomation() { Id = entity.Id, Physical = entity.FindAbility<PhysicalAbility>(), Observe = entity.FindAbility<IObserveAbility>(), Observed = entity.FindAbility<IObservedAbility>(), Move = entity.FindAbility<IMoverAbility>(), Cross = entity.FindAbility<ICrossAbility>(), Behavior = entity.FindAbility<IBehaviorAbility>(), Commander = entity.FindAbility<IBehaviorCommandAbility>(), Effect = entity.FindAbility <ISkillCaptureAbility>(), Property = entity.FindAbility<IActorPropertyAbility>(), ActorUpdate = entity.FindAbility<IActorUpdateAbility>(), }; _EntityInfomations.Add(ei); if (ei.Observe != null) { _Observes.Add(ei); } if (ei.Physical != null) { _ObseverdInfomations.Insert(ei); } _RegisterSession( entity , _Session); }
private void _UpdateObservers(EntityInfomation[] infos) { foreach (var info in infos) { var observer = info.Observe; if (observer != null) { var brounds = observer.Vision; var inbrounds = _ObseverdInfomations.Query(brounds); observer.Update(inbrounds.ToArray(), _Lefts); } } _Lefts.Clear(); }
private void _UpdateMovers(EntityInfomation[] infos) { foreach (var info in infos) { var moverAbility = info.Move; var observeAbility = info.Observe; var physical = info.Physical; if (moverAbility != null && observeAbility != null && physical != null) { var w = physical.Bounds.Width; var h = physical.Bounds.Height; var x = observeAbility.Position.X - w / 2; var y = observeAbility.Position.Y - h / 2; var brounds = new Regulus.CustomType.Rect(x, y, w, h); var inbrounds = _ObseverdInfomations.Query(brounds); var obbs = from qtoa in inbrounds let ma = qtoa.Move where ma != null && moverAbility != ma select ma.Obb; moverAbility.Update(_Time.Ticks, obbs); } } }