public override bool IsActionAvailable(ObjectAction action) { if (action == ObjectAction.Move) return true; if (action == ObjectAction.Rotate) return true; if (action == ObjectAction.Scale) return true; return false; }
public override bool IsActionAvailable(ObjectAction action) { if (action == ObjectAction.Move || action == ObjectAction.Rotate || action == ObjectAction.Scale) return this.HasTransform; return false; }
private void UpdateObject(object obj, ObjectAction action) { switch (action) { case ObjectAction.Delete: this.database.Data.Delete(obj); break; case ObjectAction.Modify: this.database.Data.Store(obj); break; default: throw new Exception("Invalid value for ObjectAction"); } }
public Thing(byte a_id, Model a_model, bool a_IsUnit, int a_hp, int a_maxHP, Vector3 a_position, float a_buildTime, int a_supplyValue, int a_price, addUnderAttackPosition a_function) { m_ownerID = a_id; m_isUnit = a_IsUnit; m_exists = true; m_alive = true; m_model = a_model; m_maxHP = a_maxHP; HP = a_hp; m_price = a_price; if (a_buildTime > 0) { m_HPhealFactor = 0.9f * (1 / a_buildTime); } else { m_hp = 1; } m_underAttackFunction = a_function; m_thingState = ThingState.BeingBuilt; m_currentposition = a_position; m_requiredBuildTime = a_buildTime; m_supplyValue = a_supplyValue; if (m_supplyValue < 0) { m_supplyValue = 0; } //initiate actionboxes for (int y = 0; y < m_actionbox.GetLength(1); y++) { for (int x = 0; x < m_actionbox.GetLength(0); x++) { m_actionbox[x, y] = new ObjectAction(); } } }
public UIObject(string Text, int InitialX, int InitialY, ObjectAction Action = null) { if (Action == null) { ObjectActivate = stub; } else { ObjectActivate = Action; } X = InitialX; Y = InitialY; Content = Text; Background = ConsoleColor.Black; Foreground = ConsoleColor.White; }
protected override void PostPerformAction(IEnumerable <SelObj> selObjEnum, ObjectAction action) { base.PostPerformAction(selObjEnum, action); SelShape[] selShapeArray = selObjEnum.OfType <SelShape>().ToArray(); // Update the body directly after modifying it if (this.selectedBody != null) { this.selectedBody.SynchronizeBodyShape(); } // Notify property changes DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(this.selectedBody), ReflectionInfo.Property_RigidBody_Shapes); DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(selShapeArray.Select(s => s.ActualObject))); }
/// <summary> /// Pulls actions and their parameters off the queue and executes them. /// </summary> void PaymentDealerThread() { // All the actions added to the generic list of actions and parameter will execute with this claims principal. Thread.CurrentPrincipal = new ClaimsPrincipal(WindowsIdentity.GetCurrent(), null); Thread.CurrentPrincipal = new ClaimsPrincipal(new GenericIdentity("NT AUTHORITY\\NETWORK SERVICE"), null); Thread.Sleep(ThreadSleep); bool timedOut = false; // The event handlers for the data model can't wait on locks and resources outside the data model. There would simply be too many resources that // could deadlock. This code will pull requests off of a generic queue of actions and parameters and execute them using the authentication created // above. while (true) { //Sleep if there is nothing in the Queue. if (this.actionQueue.Count == 0) { Thread.Sleep(ThreadSleep); } else { try { // The thread will wait here for the timedoutPeriod. ObjectAction objectAction = this.actionQueue.Dequeue(ThreadSleep, out timedOut); if (timedOut == false) { objectAction.DoAction(objectAction.Key, objectAction.Parameters); } else { System.Diagnostics.Debug.Assert(timedOut, "We should not be here if there is nothing in the queue"); } } catch (ThreadAbortException) { return; } catch (Exception exception) { // This will catch any exceptions thrown during the processing of the generic actions. EventLog.Error("{0} {1}: {2}\r\n{3}", this.ThreadName, exception.Message, exception.ToString(), exception.StackTrace); } } } }
private static void BusinessRulesThread() { try { BusinessRules.IsBusinessRulesThreadRunning = true; while (BusinessRules.IsBusinessRulesThreadRunning) { ObjectAction objectAction = (ObjectAction)BusinessRules.businessRuleQueue.Dequeue(); objectAction.DoAction(objectAction.Key, objectAction.Parameters); } } catch (Exception exception) { MarkThree.EventLog.Error("{0}: {1}", exception.Message, exception.StackTrace); } }
public void Execute(Entity item, ObjectAction action) { switch (action) { case ObjectAction.Add: Add((T)item); break; case ObjectAction.Delete: Remove((T)item); break; case ObjectAction.Modify: Update((T)item); break; } }
protected virtual void GameObjectInvoke(int viewId, int number) { PhotonView view = PhotonView.Find(viewId); if (syncCrossScenes == true && PhotonNetwork.IsMasterClient == true && NetworkManager.networkManager.GetChabox() && NetworkManager.networkManager.GetChabox().IsConnectedToDataChannel()) { ObjectAction objectInfo = new ObjectAction( holder.name.Replace("(Clone)", ""), SceneManager.GetActiveScene().name, null, holder.position.Round(), ObjectActionEnum.Update, "SceneUpdateGameObjectInvokeEvent", new string[2] { viewId.ToString(), number.ToString() } ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); } if (view) { if (number == 1) { NetworkGameObjectInvoke1.Invoke(view.gameObject); } else if (number == 2) { NetworkGameObjectInvoke2.Invoke(view.gameObject); } else if (number == 3) { NetworkGameObjectInvoke3.Invoke(view.gameObject); } else if (number == 4) { NetworkGameObjectInvoke4.Invoke(view.gameObject); } } }
/// <summary> /// Send this item and its item list to all other players in the session so when /// they join this scene they will have an up to date accurate item in the /// scene. Done via sending this information over the data channel on the chatbox. /// </summary> /// <param name="items">List<ItemReference> type, the list of items to add to this object</param> protected virtual IEnumerator UpdateScenesDatabase(List <ItemReference> items) { yield return(new WaitUntil(() => NetworkManager.networkManager.GetChabox() && NetworkManager.networkManager.GetChabox().IsConnectedToDataChannel() == true)); ObjectAction objectInfo = new ObjectAction( holder.name.Replace("(Clone)", ""), SceneManager.GetActiveScene().name, resourcesPrefab, holder.position.Round(), ObjectActionEnum.Create, null, SerializeItems(items) ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); }
public ActionState(PhaseController _player) : base(_player) { float min = Mathf.Infinity; ObjectAction best = player.viableAction[0]; foreach (ObjectAction x in player.viableAction) { Vector2 p = player.transform.position; Vector2 o = x.actionObject.transform.position; float tmp = (p.x - o.x) * (p.x - o.x) + (p.y - o.y) * (p.y - o.y); if (tmp < min) { min = tmp; best = x; } } player.actualAction = best; Enter(); }
public ActionEditorViewModel( IVariableWrapper variable, IEnumerable <ObjectAction> actions, DataProvider dataProvider) { _isInEditMode = false; _actions = actions; _objectsRepository = dataProvider.ObjectsRepository; _variablesRepository = dataProvider.VariablesRepository; _dialogsHelper = dataProvider.DialogsManager; Action = new ObjectAction(variable); Title = "Создание действия"; Init(); ConditionOperand = ConditionOperands.Count == 0 ? null : ConditionOperands[0]; Operation = ActionOperation.SetValue; TargetName = TargetIsEmpty ? null : TargetNames[0]; //HasChanges = false; }
protected override void OnEndAction(ObjectAction action) { base.OnEndAction(action); bool shapeAction = action != ObjectAction.RectSelect && action != ObjectAction.None; if (this.selectedBody != null && shapeAction) { this.selectedBody.EndUpdateBodyShape(); } if (this.createAction) { this.createAction = false; UndoRedoManager.EndMacro(UndoRedoManager.MacroDeriveName.FromFirst); } this.EditingUserGuide.SnapPosOrigin = Vector3.Zero; this.EditingUserGuide.SnapScaleOrigin = Vector3.One; }
protected virtual void InvokeNoInputEvent(int number) { if (syncCrossScenes == true && PhotonNetwork.IsMasterClient == true && NetworkManager.networkManager.GetChabox() && NetworkManager.networkManager.GetChabox().IsConnectedToDataChannel()) { ObjectAction objectInfo = new ObjectAction( holder.name.Replace("(Clone)", ""), SceneManager.GetActiveScene().name, null, holder.position.Round(), ObjectActionEnum.Update, "SceneUpdateNoInputInvokeEvent", new string[1] { number.ToString() } ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); } if (number == 1) { NetworkInvoke1.Invoke(); } else if (number == 2) { NetworkInvoke2.Invoke(); } else if (number == 3) { NetworkInvoke3.Invoke(); } else if (number == 4) { NetworkInvoke4.Invoke(); } else if (number == 5) { NetworkInvoke5.Invoke(); } }
public override string UpdateActionText(ObjectAction action, bool performing) { if (action == ObjectAction.Move) { return (string.Format("X:{0,7:0}/n", this.gameObj.Transform.RelativePos.X) + string.Format("Y:{0,7:0}/n", this.gameObj.Transform.RelativePos.Y) + string.Format("Z:{0,7:0}", this.gameObj.Transform.RelativePos.Z)); } else if (action == ObjectAction.Scale) { return(string.Format("Scale:{0,5:0.00}", this.gameObj.Transform.RelativeScale)); } else if (action == ObjectAction.Rotate) { return(string.Format("Angle:{0,5:0}°", MathF.RadToDeg(this.gameObj.Transform.RelativeAngle))); } return(base.UpdateActionText(action, performing)); }
// Use this for initialization void Start() { Coal = GameObject.Find("TargetObjectCoal").GetComponent <TargetObject>(); Rock = GameObject.Find("TargetObjectRock").GetComponent <TargetObject>(); CartTarget = GameObject.Find("AnimationCart").GetComponent <ObjectAction>(); Red = GameObject.Find("Red").GetComponent <Light>(); Green = GameObject.Find("Green").GetComponent <Light>(); Orange = GameObject.Find("Orange").GetComponent <Light>(); //Lever2State = GameObject.Find ("InteraciveObject2").GetComponent<InteractiveObject>(); Red.GetComponent <Light>().enabled = true; Green.GetComponent <Light>().enabled = false; Orange.GetComponent <Light>().enabled = false; PointsCounter = 0; GameObject.Find("ExplosionLight").GetComponent <Alarm>().alarmOn = false; }
void UpdateObjectInternal(object obj, ObjectAction action) { switch (action) { case ObjectAction.Add: AddInternal(obj); break; case ObjectAction.Delete: RemoveInternal(obj); break; case ObjectAction.Modify: UpdateInternal(obj); break; default: throw new Exception("Invalid value for ObjectAction"); } }
public override string UpdateActionText(ObjectAction action, bool performing) { if (action == ObjectAction.Move) { return string.Format("X:{0,7:0}/n", this.gameObj.Transform.RelativePos.X) + string.Format("Y:{0,7:0}/n", this.gameObj.Transform.RelativePos.Y) + string.Format("Z:{0,7:0}", this.gameObj.Transform.RelativePos.Z); } else if (action == ObjectAction.Scale) { return string.Format("Scale:{0,5:0.00}", this.gameObj.Transform.RelativeScale); } else if (action == ObjectAction.Rotate) { return string.Format("Angle:{0,5:0}°", MathF.RadToDeg(this.gameObj.Transform.RelativeAngle)); } return base.UpdateActionText(action, performing); }
public override void SpawnMe(Player a_player, Map a_map, PathFinder a_pathfinder) { m_actionbox[0, 0] = new ObjectAction("Release Worker", "Releases one worker! *poff*", Microsoft.Xna.Framework.Input.Keys.F, ObjectAction.Type.Instant, ReleaseWorkerFunction); m_actionbox[1, 0] = new ObjectAction("Release all Workers", "Releases all workers in this building", Microsoft.Xna.Framework.Input.Keys.D, ObjectAction.Type.Instant, ReleaseAllWorkersFunction); m_actionbox[0, 2] = new ObjectAction("Barbarian", "Cost:2\nBuild a scared Barbarian *rawr*" , Microsoft.Xna.Framework.Input.Keys.B , ObjectAction.Type.Instant, BuildBarbarianFunction); m_actionbox[2, 2] = new ObjectAction("Cancel", "Cancel what's currently being built", Microsoft.Xna.Framework.Input.Keys.Escape, ObjectAction.Type.Instant, CancelBuildFunction); m_buildBehavior = BehaviorInterfaces.BuildFactory.CreateNewStandardBuild(a_player, this, a_map, a_pathfinder); }
public override void SpawnMe(Player a_player, Map a_map, PathFinder a_pathfinder) { //abilities //build extractor m_actionbox[0, 2] = new ObjectAction("Extractor", "Cost: 15\nRequires a Spark of Life.\nExtractor will produce new Cubes until it out of resources", Microsoft.Xna.Framework.Input.Keys.E, ObjectAction.Type.Target, BuildExtractorFunction); m_actionbox[0, 2].SetBuildingTag(a_player.m_thingsAssets.m_extractor.m_size, true, a_player.m_thingsAssets.m_extractor.m_price); //Build igloo m_actionbox[1, 2] = new ObjectAction("Igloo", "Cost: 2\nBuilds an Igloo to increase your supply by 8", Microsoft.Xna.Framework.Input.Keys.G, ObjectAction.Type.Target, BuildIglooFunction); m_actionbox[1, 2].SetBuildingTag(a_player.m_thingsAssets.m_igloo.m_size, false, a_player.m_thingsAssets.m_igloo.m_price); //Build barracks m_actionbox[2, 2] = new ObjectAction("Barrack", "Costs: 5\nBuilds a barrack to produce more potent units", Microsoft.Xna.Framework.Input.Keys.B, ObjectAction.Type.Target, BuildBarrackFunction); m_actionbox[2, 2].SetBuildingTag(a_player.m_thingsAssets.m_barrack.m_size, false, a_player.m_thingsAssets.m_barrack.m_price); m_attackBehavior = new StandardAttack(this, a_player.m_thingsAssets.m_cube.m_attackBehavior.GetAttackRate() , a_player.m_thingsAssets.m_cube.m_attackBehavior.GetDamage() , a_player.m_thingsAssets.m_cube.m_attackBehavior.GetAttackRange()); //Sets the cubes moveBehavior!! m_moveBehavior = a_player.m_thingsAssets.m_cube.m_moveBehavior; //a_thing.m_buildBehavior = BuildFactory.CreateNewStandardBuild(a_player, a_thing); m_buildBehavior = BuildFactory.CreateNewVisibleBuild(a_player, this, a_player.m_thingsAssets.m_cube.m_buildBehavior.GetBuildRangeSquared(), a_map, a_pathfinder); }
/// <summary> /// Sends data via the data channel in the chatbox to everyone in the session to /// tell them that this item has been collected when they entire this unity scene. /// </summary> public virtual void ChatBoxBroadCastCollect() { if (syncCrossScenes == true && NetworkManager.networkManager.GetChabox() && NetworkManager.networkManager.GetChabox().IsConnectedToDataChannel()) { if (syncCreateDestroy == true) { ObjectAction objectInfo = new ObjectAction( holder.name.Replace("(Clone)", ""), SceneManager.GetActiveScene().name, resourcesPrefab, holder.position.Round(), ObjectActionEnum.Delete, null, null ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); } else { ObjectAction objectInfo = new ObjectAction( holder.name, SceneManager.GetActiveScene().name, resourcesPrefab, holder.position, ObjectActionEnum.Update, "SceneCollected", null ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); } } }
/// <summary> /// Will sent the `SceneBreak` function and `BroadcastData` fucntion to /// everyone that enters this photon room that joins the photon session. /// This makes it a persistant action that spans across all Unity scenes. /// </summary> public virtual void BreakObject() { if (isBroken == true) { return; } if (syncCrossScenes == true) { ObjectAction objectInfo = new ObjectAction( holder.name.Replace("(Clone)", ""), SceneManager.GetActiveScene().name, null, holder.position.Round(), ObjectActionEnum.Update, "SceneBreak", null ); NetworkManager.networkManager.GetChabox().BroadcastData( NetworkManager.networkManager.GetChatDataChannel(), objectInfo ); } SceneBreak(); }
public void Cmd_ObjectSession_PerformAction(GameObject gameObject, ObjectAction action) { //AssertGameObjectNull(obj); if (gameObject == null) { return; } ObjectSession session; if ((session = gameObject.GetComponent <ObjectSession>()) != null) { Cmd_ObjectSession_Interact_mutex.WaitOne(); // Server holds the truth //if (session.IsFallAllowed()) { session.Rpc_PerformAction(action); } Cmd_ObjectSession_Interact_mutex.ReleaseMutex(); } }
protected override string UpdateStatusText() { ObjectAction visibleObjectAction = this.VisibleObjAction; if (visibleObjectAction == ObjectAction.Move) { return(Properties.CamViewRes.CamView_Action_Move); } else if (visibleObjectAction == ObjectAction.Rotate) { return(Properties.CamViewRes.CamView_Action_Rotate); } else if (visibleObjectAction == ObjectAction.Scale) { return(Properties.CamViewRes.CamView_Action_Scale); } else if (visibleObjectAction == ObjectAction.RectSelect) { return(Properties.CamViewRes.CamView_Action_Select_Active); } return(base.UpdateStatusText()); }
/// <summary> /// Pulls actions and their parameters off the queue and executes them. /// </summary> private static void FactoryThread() { // All the actions added to the generic list of actions and parameter will execute with this claims principal. Thread.CurrentPrincipal = SettlementDocumentFactory.claimsPrincipal; // The event handlers for the data model can't wait on locks and resources outside the data model. There would simply be too many resources that // could deadlock. This code will pull requests off of a generic queue of actions and parameters and execute them using the authentication created // above. while (true) { try { // The thread will wait here until an action has been placed in the queue to be processed in this thread context. ObjectAction objectAction = SettlementDocumentFactory.actionQueue.Dequeue(); objectAction.DoAction(objectAction.Key, objectAction.Parameters); } catch (Exception exception) { // This will catch any exceptions thrown during the processing of the generic actions. EventLog.Error("{0}: {1}", exception.Message, exception.StackTrace); } } }
void OnEntityModified(T entity, ObjectAction action) { EntityModified?.Invoke(this, new EntityEventArgs(entity, action, Owner.State)); }
protected virtual void OnBeginAction(ObjectAction action) { }
public override bool IsActionAvailable(ObjectAction action) { return false; }
public override string UpdateActionText(ObjectAction action, bool performing) { if (action == ObjectAction.Move) { return string.Format("Center X:{0,9:0.00}/n", this.center.X) + string.Format("Center Y:{0,9:0.00}", this.center.Y); } else if (action == ObjectAction.Scale) { if (MathF.Abs(this.scale.X - this.scale.Y) >= 0.01f) { return string.Format("Scale X:{0,8:0.00}/n", this.scale.X) + string.Format("Scale Y:{0,8:0.00}", this.scale.Y); } else { return string.Format("Scale:{0,8:0.00}", this.scale.X); } } else if (action == ObjectAction.Rotate) { return string.Format("Angle:{0,6:0.0}°", MathF.RadToDeg(this.angle)); } return base.UpdateActionText(action, performing); }
public override string UpdateActionText(ObjectAction action, bool performing) { if (action == ObjectAction.Move) { return string.Format("Center X:{0,9:0.00}/n", this.circle.Position.X) + string.Format("Center Y:{0,9:0.00}", this.circle.Position.Y); } else if (action == ObjectAction.Scale) { return string.Format("Radius:{0,8:0.00}", this.circle.Radius); } return base.UpdateActionText(action, performing); }
public override bool IsActionAvailable(ObjectAction action) { if (action == ObjectAction.Rotate) return false; return base.IsActionAvailable(action); }
protected virtual void OnEndAction(ObjectAction action) { }
public virtual string UpdateActionText(ObjectAction action, bool performing) { return(null); }
protected override void PostPerformAction(IEnumerable<SelObj> selObjEnum, ObjectAction action) { base.PostPerformAction(selObjEnum, action); if (action == ObjectAction.Move) { DualityEditorApp.NotifyObjPropChanged( this, new ObjectSelection(selObjEnum.Select(s => (s.ActualObject as GameObject).Transform)), ReflectionInfo.Property_Transform_RelativePos); } else if (action == ObjectAction.Rotate) { DualityEditorApp.NotifyObjPropChanged( this, new ObjectSelection(selObjEnum.Select(s => (s.ActualObject as GameObject).Transform)), ReflectionInfo.Property_Transform_RelativePos, ReflectionInfo.Property_Transform_RelativeAngle); } else if (action == ObjectAction.Scale) { DualityEditorApp.NotifyObjPropChanged( this, new ObjectSelection(selObjEnum.Select(s => (s.ActualObject as GameObject).Transform)), ReflectionInfo.Property_Transform_RelativePos, ReflectionInfo.Property_Transform_RelativeScale); } }
// Use this for initialization void Start() { Door = GameObject.Find("Door_Animator").GetComponent <ObjectAction>(); insideCollider = GameObject.Find("InsideRocket").GetComponent <BoxCollider> (); }
protected override void OnBeginAction(ObjectAction action) { base.OnBeginAction(action); bool shapeAction = action != ObjectAction.RectSelect && action != ObjectAction.None; if (this.selectedBody != null && shapeAction) { this.selectedBody.BeginUpdateBodyShape(); this.EditingUserGuide.SnapPosOrigin = this.selectedBody.GameObj.Transform.Pos; this.EditingUserGuide.SnapScaleOrigin = Vector3.One * this.selectedBody.GameObj.Transform.Scale; } }
public ObjectEventArgs(T obj, ObjectAction act, DatabaseState state) { this.obj = obj; this.action = act; this.state = state; }
public override bool IsActionAvailable(ObjectAction action) { return(false); }
protected override void PostPerformAction(IEnumerable<SelObj> selObjEnum, ObjectAction action) { base.PostPerformAction(selObjEnum, action); SelShape[] selShapeArray = selObjEnum.OfType<SelShape>().ToArray(); // Update the body directly after modifying it if (this.selectedBody != null) this.selectedBody.SynchronizeBodyShape(); // Notify property changes DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(this.selectedBody), ReflectionInfo.Property_RigidBody_Shapes); DualityEditorApp.NotifyObjPropChanged(this, new ObjectSelection(selShapeArray.Select(s => s.ActualObject))); }