public void Clear(Player winner, Player loser) { Free = true; Started = false; BroadcastMessage(new SDuelBroadcastRound() { Flag = 1 }); BroadcastMessage(new SDuelBroadcastResult(winner.Character.Name, loser.Character.Name)); Challenger.Session.SendAsync(new SDuelAnsExit(DuelResults.NoError, (ushort)Challenged.Session.ID, Challenged.Character.Name)).Wait(); Challenged.Session.SendAsync(new SDuelAnsExit(DuelResults.NoError, (ushort)Challenger.Session.ID, Challenger.Character.Name)).Wait(); Observers.ForEach(x => x.Character.Spells.ClearBuffByEffect(SkillStates.DuelInterface).Wait()); Observers.Clear(); ChallengerPoints = 0; ChallengedPoints = 0; Challenger.Character.Duel = null; Challenged.Character.Duel = null; Challenger.Character.CharacterRegen -= Character_CharacterRegen; Challenged.Character.CharacterRegen -= Character_CharacterRegen; Challenger.Character.PlayerDie -= ChallengerDie; Challenged.Character.PlayerDie -= ChallengedDie; Challenger.Character.WarpTo(17).Wait(); Challenged.Character.WarpTo(17).Wait(); Challenger = null; Challenged = null; }
public void Dispose() { Observers.Clear(); var disposedCopy = disposed; disposed = null; disposedCopy?.Invoke(ep); }
protected override void Reset() { m_BlendRenderer = null; m_OutfitMaterials = new OutfitMaterialTargetGroup(); // Materials Reset() is not as safe. m_Parts.Clear(0); m_Accessories.Clear(); Observers.Clear(); base.Reset(); }
public void RemoveAllObservers() { if (!isInitialized) { Debug.LogAssertion(NotYetObservingMessage); } DispatchOnFinishObserveAll(); Observers.Clear(); }
public void Clear() { Observables.Clear(); Observers.Clear(); SubjectFactories.Clear(); SubscriptionFactories.Clear(); Other.Clear(); Subscriptions.Clear(); Subjects.Clear(); ReliableSubscriptions.Clear(); }
public override IEnumerator Bind() { Type baseType = Target.GetType(); while (baseType != null && baseType != typeof(BaseController)) { yield return(Bind(baseType)); baseType = baseType.BaseType; } Observers.Clear(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> public void Initialize(GameContext context) { // TODO: Add your initialization logic here Observers.Clear(); Observers.Add(new DebugString(context)); world = World.getInstance(); world.Height = context.Height; world.Width = context.Width; Vector2 playerPosition = new Vector2(context.GraphicsDevice.Viewport.TitleSafeArea.X, context.GraphicsDevice.Viewport.TitleSafeArea.Y + context.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);//dich playerLTH = new LTH(0.1f, 0.1f, 0.03f, 0.0005f, 50, 75); compLTH = new LTH(0.1f, 0.05f, 0.03f, 0.0005f, 50, 75); pulemetTex = context.Content.Load <Texture2D>("projectiles/bullet1"); Bullet pulemetBullet = new Bullet(Vector2.Zero, 7f, 10, 5, pulemetTex); pulemet = new GunType(0.1f, 7f, 20f, pulemetBullet); Texture2D plasmaTex = context.Content.Load <Texture2D>("projectiles/bullet2"); Bullet plasmaBullet = new Bullet(Vector2.Zero, 100f, 30, 15, plasmaTex, solid: true); GunType plasmamet = new GunType(1f, 7f, 5f, plasmaBullet); Bullet magnetBullet = new MagnetBullet(Vector2.Zero, 5f, 10, 10, plasmaTex); GunType magnetmet = new GunType(0.03f, 7f, 25f, magnetBullet, 0.3f); spaceship = new Spaceship(context.Content.Load <Texture2D>("space/s2"), playerLTH, playerPosition, 0.0f); spaceship.AddGun(pulemet, new Vector2(0f, 20f)); spaceship.AddGun(pulemet, new Vector2(0f, -20f)); spaceship.AddGun(pulemet, new Vector2(40f, 15f)); spaceship.AddGun(pulemet, new Vector2(40f, -15f)); //spaceship.AddGun(magnetmet, new Vector2(40f, 0f)); playerShip = new PlayerShip(spaceship); world.playerShip = spaceship; world.players.Add(playerShip); Spaceship[] spaceship2 = new Spaceship[10]; for (int i = 0; i < 5; i++) { spaceship2[i] = new Spaceship(context.Content.Load <Texture2D>("space/vs1"), compLTH, playerPosition + new Vector2(1000, -500), 0.0f); spaceship2[i].speed = Vector2Extension.Rotate(Vector2.UnitX, i); //spaceship2[i].angularSpeed = 0.0f; spaceship2[i].angle = (float)-Math.PI / 2; spaceship2[i].AddGun(pulemet, new Vector2(20f, 0f)); world.AddObject(spaceship2[i]); world.players.Add(new ComputerShip(spaceship2[i])); } world.AddObject(spaceship); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { lock (Observers) Observers.Clear(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public override IEnumerator Bind() { foreach (MethodInfo _method in Target.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { if (_method.IsDefined(typeof(MethodObservable), true)) { MethodObservable observable = _method.GetCustomAttributes(typeof(MethodObservable), true)[0] as MethodObservable; foreach (var observer in Observers) { if (observer.GetType().GetInterfaces().Contains(observable.Type)) { PropertyInfo propertyInfo = observable.Type.GetProperties()[0]; propertyInfo.SetValue(observer, Delegate.CreateDelegate(propertyInfo.PropertyType, Target, _method.Name), null); } } } } yield return(null); Observers.Clear(); }
void Start() { if (NetworkNode.node != null) { NetworkNode.node.Subscribe(this); } Observers.Post(new GameEndMessage(this, gameEndTime)); //sends this object around, elements add their data to this object Observers.Clear(GameEndMessage.classMessageType, GoalScoredMessage.classMessageType); //Callback.FireAndForget(() => { Application.LoadLevel(Tags.Scenes.select); Destroy(this); }, gameEndTime, this, mode: Callback.Mode.REALTIME); Callback.FireForUpdate(() => Pause.pause(), this); Callback.FireAndForget(() => { Pause.unPause(); SpawnEndScreen(); }, gameEndTime, this, mode: Callback.Mode.REALTIME); /* * if (leftScore < rightScore) * Instantiate(witchesVictoryPrefab).transform.SetParent(canvas, false); * else if (leftScore > rightScore) * Instantiate(aliensVictoryPrefab).transform.SetParent(canvas, false); */ }
public void Dispose() { Observers.Clear(); }
private void ResetObservers() { Observers.Clear(); }