コード例 #1
0
        protected virtual RopesByBallons GetRopeByBallonStructureInternal(Rope2D p_rope, bool p_registerNewIfDontFind = true)
        {
            RopesByBallons v_found = null;

            if (p_rope != null)
            {
                foreach (RopesByBallons v_struct in RopesByBallonsList)
                {
                    if (v_struct != null && v_struct.Rope != null)
                    {
                        if (v_struct.Rope == p_rope)
                        {
                            v_found = v_struct;
                            break;
                        }
                    }
                    else
                    {
                        _needRemoveNulls = true;
                    }
                }
            }
            if (p_registerNewIfDontFind && v_found == null)
            {
                v_found = new RopesByBallons(p_rope);
                RopesByBallonsList.Add(v_found);
            }
            return(v_found);
        }
コード例 #2
0
        public static RopesByBallons GetRopeByBallonStructure(Rope2D p_rope, bool p_registerNewIfDontFind = true, bool p_canCreateNewControllerIfDontExists = true)
        {
            RopesByBalloonsController v_instance = GetInstance(p_canCreateNewControllerIfDontExists);
            RopesByBallons            v_return   = null;

            if (v_instance != null)
            {
                v_return = v_instance.GetRopeByBallonStructureInternal(p_rope, p_registerNewIfDontFind);
            }
            return(v_return);
        }
コード例 #3
0
ファイル: BalloonProperty.cs プロジェクト: dqtoy/GGJ2020
        //Used To Calculate amount of Direct/Indirect Ballons plugged in Ropes(Need this to know correct amount of force needed to void ropes mass
        public virtual void UpdateRopesByBalloonsController()
        {
            _waitOneCycle = true;
            RemoveSelfFromRopesByBalloonsController();
            List <RopesByBallons> v_structsThatContainBallon = RopesByBalloonsController.GetAllStructsWithBallon(this);

            foreach (RopesByBallons v_struct in v_structsThatContainBallon)
            {
                if (v_struct != null && v_struct.Rope != null)
                {
                    if (!v_struct.DirectBallons.RemoveChecking(this))
                    {
                        v_struct.IndirectBallons.RemoveChecking(this);
                    }
                }
            }
            if (m_includeIndirectRopesInMassCalc)
            {
                //Get Indirect Ropes and Add in Ballons indirect Plugged in this ropes
                foreach (Rope2D v_indirectRope in RopesAttachedComponent.IndirectRopes)
                {
                    if (v_indirectRope != null)
                    {
                        RopesByBallons v_struct = RopesByBalloonsController.GetRopeByBallonStructure(v_indirectRope, true);
                        if (v_struct != null)
                        {
                            v_struct.IndirectBallons.AddChecking(this);
                        }
                    }
                }
            }
            //Get direct Ropes and Add in Ballons Plugged in this ropes
            foreach (Rope2D v_directRope in RopesAttachedComponent.PluggedRopes)
            {
                if (v_directRope != null)
                {
                    RopesByBallons v_struct = RopesByBalloonsController.GetRopeByBallonStructure(v_directRope, true);
                    if (v_struct != null)
                    {
                        v_struct.DirectBallons.AddChecking(this);
                    }
                }
            }
        }