public override bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            base.SetSimElemInfo(info, depth);

            var a = info as AngleConstraintInfo;

            if (a == null)
            {
                return(false);
            }

            Vector3 pos = a.m.pos;

            pos.z = depth;
            transform.position = pos;

            var aAngle = a.aAngle;
            var bAngle = a.bAngle;
            var aLen   = (a.a.pos - a.m.pos).magnitude;
            var bLen   = (a.b.pos - a.m.pos).magnitude;

            _minAngle = Mathf.Min(aAngle, bAngle);
            _maxAngle = Mathf.Max(aAngle, bAngle);
            _radius   = Mathf.Max(minRadius, Mathf.Min(aLen, bLen) * 0.2f);

            SetMesh(_minAngle, _maxAngle, _radius, 10, activeColor);

            return(true);
        }
Esempio n. 2
0
        public void MakeSimElemMarker(SimElemInfo simElemInfo)
        {
            var profile = SimElemDefine.GetProfile(simElemInfo.profileID);
            var marker  = MakeMarker(profile.markerID);

            marker.SetSimElemInfo(simElemInfo, profile.markerDepth);
        }
Esempio n. 3
0
            public void Delete(SimElemInfo elem)
            {
                var idx = GetIdxByUID(elem.uid);

                if (idx > 0)
                {
                    DeleteAt(idx);
                }
            }
Esempio n. 4
0
        /*
         * Sim element callback
         */

        public void OnMakeSimElemInfo(SimElemInfo simElemInfo)
        {
            markerManager.MakeSimElemMarker(simElemInfo);
            _editableForm.AddElemInfo(simElemInfo);

            if (_editMode == EditMode.Jet)
            {
                Debug.Log("Add Jet");
                _simInteraction.AddInteractionUID("Space", simElemInfo.uid);
            }
        }
Esempio n. 5
0
        public void AddElemInfo(SimElemInfo elemInfo)
        {
            var          profile = SimElemDefine.GetProfile(elemInfo.profileID);
            SimElemGroup group;

            if (!_elemGroupDic.TryGetValue(profile.tableID, out group))
            {
                AddGroup(profile);
                group = _elemGroupDic[profile.tableID];
            }
            group.Add(elemInfo);
        }
        public override bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            base.SetSimElemInfo(info, depth);

            var jInfo = info as JetInteractionInfo;

            if (jInfo == null)
            {
                return(false);
            }

            Vector3 pos = jInfo.a.pos;

            pos.z = depth;
            transform.position = pos;

            return(true);
        }
        public override bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            base.SetSimElemInfo(info, depth);

            var a = info as PinConstraintInfo;

            if (a == null)
            {
                return(false);
            }

            Vector3 pos = a.pos;

            pos.z = depth;
            transform.position = pos;

            return(true);
        }
Esempio n. 8
0
        public override bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            base.SetSimElemInfo(info, depth);

            var pInfo = info as ParticleInfo;

            if (pInfo == null)
            {
                return(false);
            }

            Vector3 pos = pInfo.pos;

            pos.z = depth;
            transform.position = pos;

            return(true);
        }
        public override bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            base.SetSimElemInfo(info, depth);

            var s = info as SpringConstraintInfo;

            if (s == null)
            {
                return(false);
            }

            Vector3 pos = s.middlePos;

            pos.z = depth;
            transform.position   = pos;
            transform.rotation   = Quaternion.AngleAxis(s.a2bRadian * Mathf.Rad2Deg, Vector3.forward);
            transform.localScale = new Vector3(s.currentLength, 0.4f, 1f);
            return(true);
        }
Esempio n. 10
0
            /*
             * Methods
             */

            public void Add(SimElemInfo elem)
            {
                _elements.Add(elem);
            }
Esempio n. 11
0
        /*
         * Abstract methods
         */

        public virtual bool SetSimElemInfo(SimElemInfo info, float depth)
        {
            _simElemInfo = info;
            return(true);
        }