public SpectatorAction(SceneMgr mgr, Players.Player owner, params ISpectatorAction[] actions) : base(mgr, owner, actions) { this.control = owner.Device.GetControlOfType <MiningModuleControl>(); BackgroundColor = Colors.Bisque; TowardsMe = false; }
/// <summary> /// vytvori hraci action bar, input manager a zbrane a bazi nebo mining module /// </summary> /// <param name="p">hrac kteremu se maji vytvorit objekty</param> private void CreateActiveObjectsOfPlayer(Player p) { if (p.IsActivePlayer()) { p.CreateWeapons(); p.Baze = SceneObjectFactory.CreateBase(this, p); BaseIntegrityBar ellipse = SceneObjectFactory.CreateBaseIntegrityBar(this, p); HpBarControl control = new HpBarControl(ellipse); p.Baze.AddControl(control); DelayedAttachToScene(ellipse); DelayedAttachToScene(p.Baze); } else { if (p.Device == null) { MiningModule obj = SceneObjectFactory.CreateMiningModule(this, p.Data.MiningModuleStartPos, p); DelayedAttachToScene(obj); DelayedAttachToScene(SceneObjectFactory.CreateMiningModuleIntegrityBar(this, obj, p)); p.Device = obj; } } if (p.IsCurrentPlayer()) { actionBarMgr = new ActionBarMgr(this); StateMgr.AddGameState(actionBarMgr); if (p.IsActivePlayer()) { inputMgr = new PlayerInputMgr(p, this, actionBarMgr); actionBarMgr.CreateActionBarItems(p.GetActions <IPlayerAction>(), false); InitAutomaticMineLauncher(); } else { if (p.Device.HasControlOfType <MiningModuleControl>()) { return; } MiningModuleControl mc = new MiningModuleControl(); mc.Owner = p; p.Device.AddControl(mc); inputMgr = new SpectatorInputMgr(p, this, p.Device, actionBarMgr); actionBarMgr.CreateActionBarItems(p.GetActions <ISpectatorAction>(), true); SceneObjectFactory.CreateSpectatorActionReadinessIndicators(p); } } }
public SpectatorInputMgr(Player p, SceneMgr sceneMgr, ISceneObject obj, ActionBarMgr actionMgr) : base(actionMgr, sceneMgr) { IControledDevice d = obj.GetControlOfType <IControledDevice>(); MiningModuleControl mc = obj.GetControlOfType <MiningModuleControl>(); if (mc == null) { throw new Exception("You must initialize SpectatorInputManager with object containig MiningModuleControl"); } if (d == null) { throw new Exception("You must initialize SpectatorInputManager with object containig IControledDevice control"); } plr = p; device = d; miningControl = mc; }