RemoteTech.Target.Equals C# (CSharp) Method

Equals() public method

public Equals ( Target other ) : bool
other Target
return bool
        public bool Equals(Target other)
        {
            if (this.emptytarget && other.emptytarget) return true;
            if (this.node != null && other.node != null)
                return this.node.ID.Equals(other.node.ID);
            else
                return (this.referenceBody != null && other.referenceBody != null && this.referenceBody == other.referenceBody);
        }

Usage Example

Beispiel #1
0
        public SatSettingNode(PartModule m)
        {
            this.partModule = m;
            isLoaded        = true;


            if (RTUtils.containsField(partModule, "pointedAt"))
            {
                this.pointedAt = new Target((string)partModule.Fields.GetValue("pointedAt"));
            }
            else
            {
                this.pointedAt = new Target();
            }

            if (RTUtils.containsField(partModule, "dishRange"))
            {
                this.dishRange = (float)partModule.Fields.GetValue("dishRange");
            }
            else
            {
                this.dishRange = 0;
            }

            if (RTUtils.containsField(partModule, "antennaName"))
            {
                this.antennaName = (string)partModule.Fields.GetValue("antennaName");
            }


            for (int i = 0; i < RTGlobals.targets.Count; i++)
            {
                if (pointedAt.Equals(RTGlobals.targets[i]))
                {
                    selectedTarget = i; break;
                }
            }
        }