Example #1
0
    private void SoftRefreshTargets(TargetArray targets, Text[] actualForce, Text[] sumForce, bool refreshSum)
    {
        for (int i = 0; i < targets.Count; i++)
        {
            Magnetic target = targets[i];

            Vector3 heightToTop = Vector3.zero;
            heightToTop.y = target.ColliderBodyBoundsSizeY / 2f;

            Vector3 positionActualForce = CameraController.ActiveCamera.WorldToScreenPoint(target.transform.position - heightToTop) + new Vector3(0, -pixelDelta);

            if (positionActualForce.z > 0)
            {
                actualForce[i].transform.position = positionActualForce;
                actualForce[i].text = HUD.ForceString(target.LastNetForceOnTarget.magnitude, target.NetMass);
                if (refreshSum)
                {
                    sumForce[i].text = HUD.AllomanticSumString(target.LastAllomanticForce, target.LastAnchoredPushBoostFromAllomancer, target.NetMass, 2, true);
                }
            }
            else     // Target is not on screen
            {
                sumForce[i].text    = "";
                actualForce[i].text = "";
            }
        }
    }
        protected override void OnEnable()
        {
            OnBaseEnable();

            m_SelectedMaterialButton  = (MaterialButton)target;
            m_SelectedMaterialButtons = new TargetArray <MaterialButton>(targets);

            m_Interactable = serializedObject.FindProperty("m_Interactable");

            m_ResetRippleOnDisable = serializedObject.FindProperty("m_ResetRippleOnDisable");

            m_ShadowsCanvasGroup   = serializedObject.FindProperty("m_ShadowsCanvasGroup");
            m_ContentRectTransform = serializedObject.FindProperty("m_ContentRectTransform");

            m_BackgroundImage = serializedObject.FindProperty("m_BackgroundImage");
            m_Text            = serializedObject.FindProperty("m_Text");
            m_Icon            = serializedObject.FindProperty("m_Icon");

            m_ContentPaddingX = serializedObject.FindProperty("m_ContentPadding.x");
            m_ContentPaddingY = serializedObject.FindProperty("m_ContentPadding.y");

            m_FitWidthToContent  = serializedObject.FindProperty("m_FitWidthToContent");
            m_FitHeightToContent = serializedObject.FindProperty("m_FitHeightToContent");

            onPress = serializedObject.FindProperty("onPress");
            onClick = serializedObject.FindProperty("onClick");
        }
Example #3
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Enabled != null)
         {
             hashCode = hashCode * 59 + Enabled.GetHashCode();
         }
         if (Target != null)
         {
             hashCode = hashCode * 59 + Target.GetHashCode();
         }
         if (TargetArray != null)
         {
             hashCode = hashCode * 59 + TargetArray.GetHashCode();
         }
         if (Order != null)
         {
             hashCode = hashCode * 59 + Order.GetHashCode();
         }
         if (TargetSrc != null)
         {
             hashCode = hashCode * 59 + TargetSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #4
0
        void OnEnable()
        {
            OnBaseEnable();

            m_SelectedMaterialButton  = (MaterialButton)target;
            m_SelectedMaterialButtons = new TargetArray <MaterialButton>(targets);

            m_Interactable = serializedObject.FindProperty("m_Interactable");

            m_ShadowsCanvasGroup   = serializedObject.FindProperty("m_ShadowsCanvasGroup");
            m_ContentRectTransform = serializedObject.FindProperty("m_ContentRectTransform");

            m_BackgroundImage = serializedObject.FindProperty("m_BackgroundImage");
            m_Text            = serializedObject.FindProperty("m_Text");
            // [SS] BEGIN
            m_TextMeshPro = serializedObject.FindProperty("m_TextMeshPro");
            // [SS] END
            m_Icon = serializedObject.FindProperty("m_Icon");

            m_ContentPaddingX = serializedObject.FindProperty("m_ContentPadding.x");
            m_ContentPaddingY = serializedObject.FindProperty("m_ContentPadding.y");

            m_FitWidthToContent  = serializedObject.FindProperty("m_FitWidthToContent");
            m_FitHeightToContent = serializedObject.FindProperty("m_FitHeightToContent");
        }
Example #5
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Type != null)
                {
                    hashCode = hashCode * 59 + Type.GetHashCode();
                }

                if (Enabled != null)
                {
                    hashCode = hashCode * 59 + Enabled.GetHashCode();
                }

                if (Target != null)
                {
                    hashCode = hashCode * 59 + Target.GetHashCode();
                }

                if (TargetArray != null)
                {
                    hashCode = hashCode * 59 + TargetArray.GetHashCode();
                }

                if (Operation != null)
                {
                    hashCode = hashCode * 59 + Operation.GetHashCode();
                }

                if (Value != null)
                {
                    hashCode = hashCode * 59 + Value.GetHashCode();
                }

                if (PreserveGaps != null)
                {
                    hashCode = hashCode * 59 + PreserveGaps.GetHashCode();
                }

                if (ValueCalendar != null)
                {
                    hashCode = hashCode * 59 + ValueCalendar.GetHashCode();
                }

                if (TargetCalendar != null)
                {
                    hashCode = hashCode * 59 + TargetCalendar.GetHashCode();
                }

                if (TargetSrc != null)
                {
                    hashCode = hashCode * 59 + TargetSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Example #6
0
 protected virtual void Awake()
 {
     rb           = GetComponent <Rigidbody>();
     Charge       = Mathf.Pow(Mass, chargePower);
     IronReserve  = gameObject.AddComponent <MetalReserve>();
     SteelReserve = gameObject.AddComponent <MetalReserve>();
     PullTargets  = new TargetArray(maxNumberOfTargets);
     PushTargets  = new TargetArray(maxNumberOfTargets);
     GameManager.AddAllomancer(this);
 }
Example #7
0
    /*
     * Swaps the contents of this TargetArray with another.
     * They should have the same Size.
     */
    public void SwapContents(TargetArray other)
    {
        Magnetic[] temp = targets;
        targets       = other.targets;
        other.targets = temp;

        int tempCount = Count;

        Count       = other.Count;
        other.Count = tempCount;
    }
Example #8
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Sort other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Enabled == other.Enabled ||
                     Enabled != null &&
                     Enabled.Equals(other.Enabled)
                 ) &&
                 (
                     Target == other.Target ||
                     Target != null &&
                     Target.Equals(other.Target)
                 ) &&
                 (
                     Equals(TargetArray, other.TargetArray) ||
                     TargetArray != null && other.TargetArray != null &&
                     TargetArray.SequenceEqual(other.TargetArray)
                 ) &&
                 (
                     Order == other.Order ||
                     Order != null &&
                     Order.Equals(other.Order)
                 ) &&
                 (
                     TargetSrc == other.TargetSrc ||
                     TargetSrc != null &&
                     TargetSrc.Equals(other.TargetSrc)
                 ));
        }
Example #9
0
        void OnEnable()
        {
            OnBaseEnable();

            m_SelectedPanelExpander  = (PanelExpander)target;
            m_SelectedPanelExpanders = new TargetArray <PanelExpander>(targets);

            m_ExpandMode           = serializedObject.FindProperty("m_ExpandMode");
            m_AutoExpandedSize     = serializedObject.FindProperty("m_AutoExpandedSize");
            m_ExpandedSize         = serializedObject.FindProperty("m_ExpandedSize");
            m_AutoExpandedPosition = serializedObject.FindProperty("m_AutoExpandedPosition");
            m_ExpandedPosition     = serializedObject.FindProperty("m_ExpandedPosition");

            m_RippleHasShadow        = serializedObject.FindProperty("m_RippleHasShadow");
            m_AnimationDuration      = serializedObject.FindProperty("m_AnimationDuration");
            m_DarkenBackground       = serializedObject.FindProperty("m_DarkenBackground");
            m_ClickBackgroundToClose = serializedObject.FindProperty("m_ClickBackgroundToClose");

            m_PanelRootRectTransform  = serializedObject.FindProperty("m_PanelRootRectTransform");
            m_PanelContentCanvasGroup = serializedObject.FindProperty("m_PanelContentCanvasGroup");
            m_PanelShadowCanvasGroup  = serializedObject.FindProperty("m_PanelShadowCanvasGroup");
            m_BaseRectTransform       = serializedObject.FindProperty("m_BaseRectTransform");
        }
Example #10
0
        public bool Equals([AllowNull] Filter other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Enabled == other.Enabled && Enabled != null && other.Enabled != null && Enabled.Equals(other.Enabled)) &&
                   (Target == other.Target && Target != null && other.Target != null && Target.Equals(other.Target)) &&
                   (Equals(TargetArray, other.TargetArray) || TargetArray != null && other.TargetArray != null && TargetArray.SequenceEqual(other.TargetArray)) &&
                   (Operation == other.Operation && Operation != null && other.Operation != null && Operation.Equals(other.Operation)) &&
                   (Value == other.Value && Value != null && other.Value != null && Value.Equals(other.Value)) &&
                   (PreserveGaps == other.PreserveGaps && PreserveGaps != null && other.PreserveGaps != null && PreserveGaps.Equals(other.PreserveGaps)) &&
                   (ValueCalendar == other.ValueCalendar && ValueCalendar != null && other.ValueCalendar != null && ValueCalendar.Equals(other.ValueCalendar)) &&
                   (TargetCalendar == other.TargetCalendar && TargetCalendar != null && other.TargetCalendar != null && TargetCalendar.Equals(other.TargetCalendar)) &&
                   (TargetSrc == other.TargetSrc && TargetSrc != null && other.TargetSrc != null && TargetSrc.Equals(other.TargetSrc)));
        }