示例#1
0
        /// <summary>
        /// Constructor call.  Creates a new Door object.
        /// </summary>
        /// <param name="content">The content manager to use when loading assets.</param>
        /// <param name="orient">The orientation of the room (either facing left or facing right).</param>
        /// <param name="roomName">The name of the room that the door leads to.</param>
        /// <param name="connectedDoorIndex">The index of the door that is linked to this one.</param>
        /// <param name="lockT">The type of lock that is on this door.</param>
        public Door(ContentManager content, AudioEngine audioEngine, DoorOrientations orient, string roomName, int connectedDoorIndex, Locks lockT)
            : base("Door", content)
        {
            Content = content;
            soundEngine = audioEngine;
            orientation = orient;
            linkedRoom = null;
            linkedRoomName = roomName;
            linkedDoorIndex = connectedDoorIndex;
            lockType = lockT;

            isOpen = false;
            isSolid = true;

            switch (lockType)
            {
                case Locks.Unlocked:
                    animation = Animations.Unlocked;
                    break;
                case Locks.Red:
                    animation = Animations.RedLock;
                    break;
                default:
                    animation = Animations.Unlocked;
                    break;
            }

            currentAnimation = (int)animation + (int)orientation;
        }
示例#2
0
		/// <summary>
		/// Returns true if given lock isn't activated.
		/// </summary>
		/// <param name="locks"></param>
		/// <returns></returns>
		public bool Can(Locks locks)
		{
			return ((this.Locks & locks) == 0);
		}
示例#3
0
		/// <summary>
		/// Deactivates given Locks for creature.
		/// </summary>
		/// <remarks>
		/// Unlocking movement on the client apparently resets skill stuns.
		/// </remarks>
		/// <param name="locks">Locks to deactivate.</param>
		/// <param name="updateClient">Sends CharacterUnlock to client if true.</param>
		/// <returns>Creature's current lock value after deactivating given locks.</returns>
		public Locks Unlock(Locks locks, bool updateClient = false)
		{
			var prev = this.Locks;
			this.Locks &= ~locks;

			if (updateClient /*&& prev != this.Locks*/)
				Send.CharacterUnlock(this, locks);

			return this.Locks;
		}
        public static void SetLocks(MetaModel metaModel, Locks locks)
        {
            if (metaModel == null)
                return;

            ImmutabilityExtensionMethods.SetLocks(metaModel, locks);

            foreach (PropertyGridEditor p in metaModel.PropertyGridEditors)
                ImmutabilityExtensionMethods.SetLocks(p, locks);

            foreach (DomainType p in metaModel.DomainTypes)
                ImmutabilityExtensionMethods.SetLocks(p, locks);

            foreach (BaseModelContext p in metaModel.ModelContexts)
            {
                ImmutabilityExtensionMethods.SetLocks(p, locks);

                if (p is LibraryModelContext)
                {
                    foreach (DiagramClass d in (p as LibraryModelContext).DiagramClasses)
                    {
                        ImmutabilityExtensionMethods.SetLocks(d, locks);
                        foreach (PresentationElementClass pe in d.PresentationElements)
                            ImmutabilityExtensionMethods.SetLocks(pe, locks);
                    }

                    LibraryModelContext lib = p as LibraryModelContext;
                    if (lib.SerializationModel != null)
                    {
                        ImmutabilityExtensionMethods.SetLocks(lib.SerializationModel, locks);
                        foreach (SerializationClass s in lib.SerializationModel.Children)
                        {
                            if (s == null)
                                continue;

                            ImmutabilityExtensionMethods.SetLocks(s, locks);
                            foreach(SerializationAttributeElement attr in s.Attributes )
                                if( attr != null )
                                ImmutabilityExtensionMethods.SetLocks(attr, locks);

                            foreach(SerializationElement element in s.Children)
                                if( element is SerializationAttributeElement )
                                    ImmutabilityExtensionMethods.SetLocks(element, locks);

                            if (s is SerializedReferenceRelationship)
                            {
                                SerializedReferenceRelationship sRef = s as SerializedReferenceRelationship;
                                foreach(SerializedDomainRole role in sRef.SerializedDomainRoles)
                                    ImmutabilityExtensionMethods.SetLocks(role, locks);
                            }
                        }
                    }
                }
            }

            if (metaModel.AdditionalInformation != null)
            {
                ImmutabilityExtensionMethods.SetLocks(metaModel.AdditionalInformation, locks);

                if (metaModel.AdditionalInformation.FurtherInformation != null)
                {
                    ImmutabilityExtensionMethods.SetLocks(metaModel.AdditionalInformation.FurtherInformation, locks);
                    foreach (InformationItem p in metaModel.AdditionalInformation.FurtherInformation.InformationItems)
                        ImmutabilityExtensionMethods.SetLocks(p, locks);
                }

                if (metaModel.AdditionalInformation.Credits != null)
                {
                    ImmutabilityExtensionMethods.SetLocks(metaModel.AdditionalInformation.Credits, locks);
                    foreach (CreditItem p in metaModel.AdditionalInformation.Credits.CreditItems)
                        ImmutabilityExtensionMethods.SetLocks(p, locks);
                }
            }

            foreach (DomainClass p in metaModel.AllClasses)
            {
                ImmutabilityExtensionMethods.SetLocks(p, locks);
                foreach (DomainProperty prop in p.Properties)
                    ImmutabilityExtensionMethods.SetLocks(prop, locks);
            }

            foreach (DomainRelationship p in metaModel.AllRelationships)
            {
                ImmutabilityExtensionMethods.SetLocks(p, locks);
                foreach (DomainProperty prop in p.Properties)
                    ImmutabilityExtensionMethods.SetLocks(prop, locks);
                foreach (DomainRole prop in p.Roles)
                    ImmutabilityExtensionMethods.SetLocks(prop, locks);
            }

            if (metaModel.Validation != null)
                ImmutabilityExtensionMethods.SetLocks(metaModel.Validation, locks);
        }
示例#5
0
文件: Creature.cs 项目: xKamuna/aura
		/// <summary>
		/// Activates given Locks for creature.
		/// </summary>
		/// <remarks>
		/// Some locks are lifted automatically on Warp, SkillComplete,
		/// and SkillCancel.
		/// </remarks>
		/// <param name="locks">Locks to activate.</param>
		/// <param name="updateClient">Sends CharacterLock to client if true.</param>
		/// <returns>Creature's current lock value after activating given locks.</returns>
		public Locks Lock(Locks locks, bool updateClient = false)
		{
			var prev = this.Locks;
			this.Locks |= locks;

			if (updateClient && prev != this.Locks)
				Send.CharacterLock(this, locks);

			return this.Locks;
		}