Esempio n. 1
0
        public void OnSetSubviewCamera(SubviewType subviewType, Camera camera, bool isShowing)
        {
            int index = (int)subviewType - 1;

            if ((DateTime.Now - this.subviewLastUpdateTime[index]).TotalMilliseconds < MaxCameraListUpdateInterval)
            {
                SIGVerseLogger.Warn("The update time interval of Subview is too short. (<" + MaxCameraListUpdateInterval + "[ms])");
                return;
            }

            this.subviewLastUpdateTime[index] = DateTime.Now;

            // Update button state
            if (isShowing)
            {
                this.subviewPanels[index].SetActive(true);
            }
            else
            {
                this.subviewPanels[index].SetActive(false);
            }

            this.UpdateButtonState(this.subviewPanels[index], this.subviewButtons[index]);

            // Update a camera info
            this.ChangeCamera(index, camera);
        }
        public static bool IsOverLimitSpeed <TJoint>(List <TJoint> trajectoryKeyList, Dictionary <TJoint, TrajectoryInfo> trajectoryInfoMap, Func <TJoint, float> getMaxJointSpeedFunc)
        {
            foreach (TJoint joint in trajectoryKeyList)
            {
                if (trajectoryInfoMap[joint] == null)
                {
                    continue;
                }

                List <float> trajectoryInfoDurations     = new List <float>(trajectoryInfoMap[joint].Durations);
                List <float> trajectoryInfoGoalPositions = new List <float>(trajectoryInfoMap[joint].GoalPositions);

                trajectoryInfoDurations.Insert(0, 0.0f);
                trajectoryInfoGoalPositions.Insert(0, trajectoryInfoMap[joint].CurrentPosition);

                for (int i = 1; i < trajectoryInfoGoalPositions.Count; i++)
                {
                    double tempDistance  = Math.Abs(trajectoryInfoGoalPositions[i] - trajectoryInfoGoalPositions[i - 1]);
                    double tempDurations = Math.Abs(trajectoryInfoDurations    [i] - trajectoryInfoDurations[i - 1]);
                    double tempSpeed     = tempDistance / tempDurations;

                    if (tempSpeed > getMaxJointSpeedFunc(joint))
                    {
                        SIGVerseLogger.Warn("Trajectry speed error. Joint Name=" + joint.ToString() + ", Speed=" + tempSpeed + ", Max Speed=" + getMaxJointSpeedFunc(joint) + ")");
                        return(true);
                    }
                }
            }

            return(false);
        }
Esempio n. 3
0
        public void OnUpdateCameraListButtonClick()
        {
            if ((DateTime.Now - this.cameraListLastUpdateTime).TotalMilliseconds < MaxCameraListUpdateInterval)
            {
                SIGVerseLogger.Warn("The update time interval of the camera list is too short. (<" + MaxCameraListUpdateInterval + "[ms])");
                return;
            }

            this.cameraListLastUpdateTime = DateTime.Now;

            this.UpdateCameraList();
        }
Esempio n. 4
0
        public static void SetSubviewPosition(SubviewType subviewType, SubviewPositionType subviewPositionType, float offsetX, float offsetY, float sizeX, float sizeY)
        {
            SIGVerseMenu sigverseMenu = GameObject.FindObjectOfType <SIGVerseMenu>();

            if (sigverseMenu == null)
            {
                SIGVerseLogger.Warn("SIGVerseMenu is not exists.");
                return;
            }

            ExecuteEvents.Execute <ISubviewHandler>
            (
                target: sigverseMenu.gameObject,
                eventData: null,
                functor: (reciever, eventData) => reciever.OnSetSubviewPosition(subviewType, subviewPositionType, offsetX, offsetY, sizeX, sizeY)
            );
        }
Esempio n. 5
0
        public static void SetSubviewCamera(SubviewType subviewType, Camera camera)
        {
            SIGVerseMenu sigverseMenu = GameObject.FindObjectOfType <SIGVerseMenu>();

            if (sigverseMenu == null)
            {
                SIGVerseLogger.Warn("SIGVerseMenu is not exists.");
                return;
            }

            ExecuteEvents.Execute <ISubviewHandler>
            (
                target: sigverseMenu.gameObject,
                eventData: null,
                functor: (reciever, eventData) => reciever.OnSetSubviewCamera(subviewType, camera)
            );
        }
        protected bool IsValidTriggerEnter(Collider other)
        {
            if (other.isTrigger)
            {
                return(false);
            }

            if (other.attachedRigidbody == null)
            {
                return(false);
            }

            if (this.rigidbodyMap.ContainsKey(other))
            {
                SIGVerseLogger.Warn("This Collider has already been added. (" + this.GetType().FullName + ")  name=" + SIGVerseUtils.GetHierarchyPath(other.transform));
                return(false);
            }

            return(true);
        }
        protected bool IsValidTriggerExit(Collider other)
        {
            if (other.isTrigger)
            {
                return(false);
            }

            if (other.attachedRigidbody == null)
            {
                return(false);
            }

            if (!this.rigidbodyMap.ContainsKey(other))
            {
                SIGVerseLogger.Warn("This Collider does not exist in the Dictionary. (" + this.GetType().FullName + ")  name=" + SIGVerseUtils.GetHierarchyPath(other.transform));
                return(false);
            }

            return(true);
        }