예제 #1
0
        //------------------------------------------------------------------------/
        // Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Adds the status. If it is already present, it will follow whatever
        /// rules for stackability/diminishing returns it has.
        /// </summary>
        /// <param name="status">The instance of the status to be added.</param>
        public void Add(Status.Instance newStatus)
        {
            //Trace.Script("Adding" + newStatus.Name);

            // Apply its initial effect
            newStatus.Start();

            // Check whether an instance of the status is already present
            var presentStatus = Find(newStatus.status);

            if (presentStatus != null)
            {
                // Determine whether to stack it
                if (presentStatus.status.IsStackable)
                {
                    presentStatus.Stack();
                }
                // Determine whether to reset its duration
                presentStatus.Reset();
            }
            // If not present, add it
            else
            {
                statuses.Add(newStatus);
            }
        }
예제 #2
0
        //public void Add()

        /// <summary>
        /// Removes this status.
        /// </summary>
        /// <param name="status"></param>
        public void Remove(Status.Instance status)
        {
            // Announce the status has been removed
            var endedEvent = new Status.EndedEvent();

            endedEvent.status = status;
            status.target.gameObject.Dispatch <Status.EndedEvent>(endedEvent);
            // Now remove it
            statuses.Remove(status);
        }