public void CmdPullObject(GameObject obj) { if (isPulling) { GameObject cObj = gameObject.GetComponent <PlayerSync>().pullingObject; cObj.GetComponent <ObjectActions>().pulledBy = null; gameObject.GetComponent <PlayerSync>().pullObjectID = NetworkInstanceId.Invalid; } ObjectActions pulled = obj.GetComponent <ObjectActions>(); //Other player is pulling object, send stop on that player if (pulled.pulledBy != null) { if (pulled.pulledBy != gameObject) { pulled.GetComponent <PlayerNetworkActions>().CmdStopPulling(obj); } } if (pulled != null) { PlayerSync pS = GetComponent <PlayerSync>(); pS.pullObjectID = pulled.netId; isPulling = true; } }
private void Awake() { colliders = GetComponents <Collider2D>(); registerTile = GetComponent <RegisterTile>(); objectActions = GetComponent <ObjectActions>(); closetControl = GetComponent <ClosetControl>(); }
public void PullReset(NetworkInstanceId netID) { if (netID == null) { netID = NetworkInstanceId.Invalid; } transform.hasChanged = false; if (netID == NetworkInstanceId.Invalid) { if (pullingObject != null) { pullRegister.editModeControl.Snap(); pullRegister.UpdateTile(pullingObject.transform.position); EditModeControl eM = pullingObject.GetComponent <EditModeControl>(); eM.Snap(); } pullRegister = null; pullingObject = null; } else { pullingObject = ClientScene.FindLocalObject(netID); ObjectActions oA = pullingObject.GetComponent <ObjectActions>(); pullPos = pullingObject.transform.position; if (oA != null) { oA.pulledBy = gameObject; } pullRegister = pullingObject.GetComponent <RegisterTile>(); } }
public IActionSpec[] GetLocallyContributedActions(ITypeSpec typeSpec, string id) { if (!locallyContributedActions.ContainsKey(id)) { locallyContributedActions[id] = ObjectActions.Where(oa => oa.IsLocallyContributedTo(typeSpec, id)).ToArray(); } return(locallyContributedActions[id]); }
public void CmdTryPush(GameObject obj, Vector3 pos) { ObjectActions pushed = obj.GetComponent <ObjectActions>(); if (pushed != null) { pushed.serverPos = pos; } }
/// <summary> /// Initializes a new instance of the ObjectEventArgs class. /// </summary> /// <param name="context">The context of the event.</param> /// <param name="action">The action being taken on the object.</param> public ObjectEventArgs(object context, ObjectActions action) { //if (context == null) //{ // throw new ArgumentNullException("context"); //} _context = context; _action = action; }
public WorldObjectBase(string name, List <IItem> items, Objects objectType, ObjectActions objectActionType) { ObjectId = WorldObjectManager.GetUniqueWorldObjectId(); WorldObjectManager.AddWorldObject(this); Name = name; Items = items; ObjectType = objectType; ObjectActionType = objectActionType; }
public ObjectActions GetObjectActions() { if (isObject) { foreach (var tile in tiles) { var registerTile = tile.GetComponent <RegisterTile>(); if (registerTile.TileType == TileType.Object) { ObjectActions objCollisions = registerTile.gameObject.GetComponent <ObjectActions>(); return(objCollisions); } } } return(null); }
public override void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue <Type>("Type", Type); info.AddValue <string>("FullName", FullName); info.AddValue <string>("ShortName", ShortName); info.AddValue <IIdentifier>("identifier", identifier); info.AddValue <IList <IAssociationSpecImmutable> >("Fields", Fields.ToList()); info.AddValue <IList <ITypeSpecImmutable> >("Interfaces", Interfaces.ToList()); info.AddValue <ITypeSpecImmutable>("Superclass", Superclass); info.AddValue <IList <ITypeSpecImmutable> >("subclasses", subclasses.ToList()); info.AddValue <IList <IActionSpecImmutable> >("ObjectActions", ObjectActions.ToList()); info.AddValue <IList <IActionSpecImmutable> >("ContributedActions", ContributedActions.ToList()); info.AddValue <IList <IActionSpecImmutable> >("CollectionContributedActions", CollectionContributedActions.ToList()); info.AddValue <IList <IActionSpecImmutable> >("FinderActions", FinderActions.ToList()); base.GetObjectData(info, context); }
internal virtual void GoBoom() { if (spriteRend.isVisible) { Camera2DFollow.followControl.Shake(0.2f, 0.2f); } // Instantiate a clone of the source so that multiple explosions can play at the same time. spriteRend.enabled = false; try{ Matrix.Matrix.At(transform.position).TryRemoveTile(gameObject); ObjectActions oA = gameObject.GetComponent <ObjectActions>(); if (oA != null) { if (oA.pusher == PlayerManager.LocalPlayer) { PlayerManager.LocalPlayerScript.playerMove.isPushing = false; } oA.isPushable = false; } } catch { Debug.LogWarning("Object may of already been removed"); } Collider2D[] getColls = gameObject.GetComponents <Collider2D>(); for (int i = 0; i < getColls.Length; i++) { getColls[i].enabled = false; } var name = explosions[Random.Range(0, explosions.Length)]; var source = SoundManager.Instance[name]; if (source != null) { Instantiate <AudioSource>(source, transform.position, Quaternion.identity).Play(); } var fireRing = Resources.Load <GameObject>("effects/FireRing"); Instantiate(fireRing, transform.position, Quaternion.identity); var lightFx = Resources.Load <GameObject>("lighting/BoomLight"); lightFxInstance = Instantiate(lightFx, transform.position, Quaternion.identity); lightSprite = lightFxInstance.GetComponentInChildren <LightSprite>(); lightSprite.fadeFX(1f); SetFire(); }
public void CmdStopPulling(GameObject obj) { if (!isPulling) { return; } isPulling = false; ObjectActions pulled = obj.GetComponent <ObjectActions>(); if (pulled != null) { // //this triggers currentPos syncvar hook to make sure registertile is been completed on all clients // pulled.currentPos = pulled.transform.position; PlayerSync pS = gameObject.GetComponent <PlayerSync>(); pS.pullObjectID = NetworkInstanceId.Invalid; pulled.pulledBy = null; } }
public void changeObject(ObjectActions obj) { currentObject = obj; foreach (KeyValuePair <string, ObjectActions> entry in availableActions) { // do something with entry.Value or entry.Key entry.Value.text.color = inactiveColor; } availableActions.Clear(); for (int i = 0; i < obj.actions.Length; i++) { obj.actions[i].text.color = activeColor; availableActions.Add(obj.actions[i].name, obj.actions[i]); } //controller.changePlayerPosition(); destSetter.target = currentObject.transform; nearTarget = false; }
public ObjectEventArgs(object context, ObjectActions action) : base() { _context = context; _action = action; }
/// <summary> /// Initializes a new instance of the TypeEventArgs class /// </summary> /// <param name="context">The context of this event</param> /// <param name="action">The action that describes this event context</param> public TypeEventArgs(Type context, ObjectActions action) : base((object)context, action) { }
/// <summary> /// Initializes a new instance of the ObjectCancelEventArgs class. /// </summary> /// <param name="context">The context of the event.</param> /// <param name="action">The action being taken on the object.</param> /// <param name="cancel">A flag that indicates whether the event should be cancelled.</param> public ObjectCancelEventArgs(object context, ObjectActions action, bool cancel) : base(context, action) { _cancel = cancel; }
public TypeCollectionEventArgs(Type context, ObjectActions action) : base(context, action) { }
public TreeObject(string name, List <IItem> items, Objects objectType, ObjectActions objectActionType) : base(name, items, objectType, objectActionType) { }
/// <summary> /// Initializes a new instance of the KeyedObjectEventArgs class. /// </summary> /// <param name="context">The object that is the context of the event.</param> /// <param name="action">The action being taken on the context.</param> public KeyedObjectEventArgs(KeyedObject context, ObjectActions action) : base(context, action) { }
/// <summary> /// Initializes a new instance of the KeyedObjectCancelEventArgs class. /// </summary> /// <param name="context">The object that is the context of the event.</param> /// <param name="action">The action being taken on the context.</param> /// <param name="cancel">A flag that indicates whether the event will be cancelled.</param> public KeyedObjectCancelEventArgs(KeyedObject context, ObjectActions action, bool cancel) : base(context, action, cancel) { }
public override IActionSpec[] GetActions() => ObjectActions.Union(ContributedActions).ToArray();
public ObjectBaseEventArgs(ObjectBase context, ObjectActions action) : base(context, action) { }
private void Awake() { objectActions = GetComponent <ObjectActions>(); }
public ObjectBaseCancelEventArgs(ObjectBase context, ObjectActions action, bool cancel) : base(context, action, cancel) { }
private void DecorateAllFacets(IFacetDecoratorSet decorator) { decorator.DecorateAllHoldersFacets(this); Fields.ForEach(decorator.DecorateAllHoldersFacets); ObjectActions.Where(s => s != null).ForEach(action => DecorateAction(decorator, action)); }
// Start is called before the first frame update void Start() { objActions = triggerObject.GetComponent <ObjectActions>(); openDoorAnim = GetComponent <Animator>(); }