Ejemplo n.º 1
0
        public static void UpdateBuff(Mobile from, Mobile target = null)
        {
            var item = from.FindItemOnLayer(Layer.TwoHanded);

            if (item == null)
            {
                item = from.FindItemOnLayer(Layer.OneHanded);
            }

            if (item == null)
            {
                if (m_Table.ContainsKey(from))
                {
                    m_Table.Remove(from);
                    BuffInfo.RemoveBuff(from, BuffIcon.RageFocusingBuff);
                }
            }
            else if (item is BaseWeapon && ((BaseWeapon)item).ExtendedWeaponAttributes.Focus > 0)
            {
                if (m_Table.ContainsKey(from))
                {
                    FocusInfo info = m_Table[from];

                    BuffInfo.AddBuff(from, new BuffInfo(BuffIcon.RageFocusingBuff, 1151393, 1151394,
                                                        string.Format("{0}\t{1}", info.Target == null ? "NONE" : info.Target.Name, info.DamageBonus)));
                }

                m_Table[from] = new FocusInfo(target, DefaultDamageBonus);
            }
        }
Ejemplo n.º 2
0
                /// <summary>
                /// Casts a ray against all colliders.
                /// </summary>
                /// <param name="index">A source of eye gaze data.</param>
                /// <param name="ray">The starting point and direction of the ray.</param>
                /// <param name="focusInfo">Information about where the ray focused on.</param>
                /// <param name="radius">The radius of the gaze ray</param>
                /// <param name="maxDistance">The max length of the ray.</param>
                /// <returns>Indicates whether the ray hits a collider.</returns>
                public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, float radius, float maxDistance)
                {
                    UpdateData();
                    bool valid = GetGazeRay(index, out ray);

                    if (valid)
                    {
                        Ray        rayGlobal = new Ray(Camera.main.transform.position, Camera.main.transform.TransformDirection(ray.direction));
                        RaycastHit hit;
                        if (radius == 0)
                        {
                            valid = Physics.Raycast(rayGlobal, out hit, maxDistance, -1);
                        }
                        else
                        {
                            valid = Physics.SphereCast(rayGlobal, radius, out hit, maxDistance, -1);
                        }
                        focusInfo = new FocusInfo
                        {
                            point     = hit.point,
                            normal    = hit.normal,
                            distance  = hit.distance,
                            collider  = hit.collider,
                            rigidbody = hit.rigidbody,
                            transform = hit.transform
                        };
                    }
                    else
                    {
                        focusInfo = new FocusInfo();
                    }
                    return(valid);
                }
Ejemplo n.º 3
0
        public static int GetBonus(Mobile from, Mobile target)
        {
            if (m_Table.ContainsKey(from))
            {
                FocusInfo info = m_Table[from];

                if (info.Target == target)
                {
                    return(info.DamageBonus);
                }
            }

            return(0);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Late update for the cursor updating state and position.
        /// </summary>
        public virtual void LateUpdate()
        {
            if (m_Focuser != null)
            {
                cursorHit = m_Focuser.FocusHitInfo;
            }

            this.UpdateTransform();

            CursorState newState = CheckCursorState();

            if (currentState != newState)
            {
                OnStateChange(newState);
            }

            UpdateWidgets();

            OnPostUpdateTransform();
        }
Ejemplo n.º 5
0
 protected override void ChangeElement(NodeEditableElement element, object value)
 {
     if (element.ElementType == ElementType.Operation && !Enum.IsDefined(typeof(ClauseType), value))
     {
         Model.BeginUpdate();
         Operation = (ClauseType)value;
         var clauseType = (int)value;
         if (clauseType == ClauseTypeEnumHelper.FullText)
         {
             FilterControlHelpers.ForceAdditionalParamsCount(AdditionalOperands, 1);
         }
         Model.EndUpdate(FilterChangedAction.OperationChanged, this);
         FilterControlFocusInfo fi = FocusInfo.OnRight();
         if (fi.Node == FocusInfo.Node)
         {
             FocusInfo = fi;
         }
     }
     else
     {
         base.ChangeElement(element, value);
     }
 }
Ejemplo n.º 6
0
        public static void OnHit(Mobile attacker, Mobile defender)
        {
            if (m_Table.ContainsKey(attacker))
            {
                FocusInfo info = m_Table[attacker];

                if (info.Target == null)
                {
                    info.DamageBonus -= 10;
                }
                else if (info.Target == defender)
                {
                    if (info.DamageBonus < -40)
                    {
                        info.DamageBonus += 10;
                    }
                    else
                    {
                        info.DamageBonus += 8;
                    }
                }
                else
                {
                    if (info.DamageBonus >= -50)
                    {
                        info.DamageBonus = DefaultDamageBonus;
                    }
                }

                if (info.Target != defender)
                {
                    info.Target = defender;
                }

                UpdateBuff(attacker, defender);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Casts a ray against all colliders.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo)
 {
     return(Focus(index, out ray, out focusInfo, 0, float.MaxValue));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Casts a ray against all colliders.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo)
 {
     UpdateData();
     return(Focus(index, out ray, out focusInfo, EyeData_));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Casts a ray against all colliders when enable eye callback function.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <param name="eye_data">ViveSR.anipal.Eye.EyeData. </param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, EyeData eye_data)
 {
     return(Focus(index, out ray, out focusInfo, 0, float.MaxValue, -1, eye_data));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Casts a ray against all colliders.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <param name="maxDistance">The max length of the ray.</param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, float maxDistance)
 {
     UpdateData();
     return(Focus(index, out ray, out focusInfo, maxDistance, EyeData_));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Casts a ray against all colliders.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <param name="radius">The radius of the gaze ray</param>
 /// <param name="maxDistance">The max length of the ray.</param>
 /// <param name="eye_data">ViveSR.anipal.Eye.EyeData. </param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, float radius, float maxDistance, EyeData eye_data)
 {
     return(Focus(index, out ray, out focusInfo, radius, maxDistance, -1, eye_data));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Casts a ray against all colliders.
 /// </summary>
 /// <param name="index">A source of eye gaze data.</param>
 /// <param name="ray">The starting point and direction of the ray.</param>
 /// <param name="focusInfo">Information about where the ray focused on.</param>
 /// <param name="radius">The radius of the gaze ray</param>
 /// <param name="maxDistance">The max length of the ray.</param>
 /// <param name="focusableLayer">A layer id that is used to selectively ignore object.</param>
 /// <returns>Indicates whether the ray hits a collider.</returns>
 public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, float radius, float maxDistance, int focusableLayer)
 {
     UpdateData();
     return(Focus(index, out ray, out focusInfo, radius, maxDistance, focusableLayer, EyeData_));
 }