protected void Awake() { this.collisionEffect = (GameObject)Resources.Load(CompetitionUtils.CollisionEffectPath); GameObject robot = GameObject.FindGameObjectWithTag(TagRobot); this.hsrBaseColliders = new List <Collider>(); this.hsrBaseColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, HSRCommon.BaseName).GetComponentsInChildren <Collider>()); this.hsrBaseColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, HSRCommon.BumperName).GetComponentsInChildren <Collider>()); this.hsrHandColliders = new List <Collider>(); this.hsrHandColliders.AddRange(SIGVerseUtils.FindTransformFromChild(robot.transform.root, HSRCommon.WristRollLinkName).GetComponentsInChildren <Collider>()); this.hsrGraspingDetector = robot.GetComponent <HSRGraspingDetector>(); }
private void GetGameObjects(GameObject avatarMotionPlayback, GameObject worldPlayback) { this.robot = GameObject.FindGameObjectWithTag(TagRobot); this.hsrBaseFootPrint = SIGVerseUtils.FindTransformFromChild(this.robot.transform, HSRCommon.BaseFootPrintName); this.hsrGraspingDetector = this.robot.GetComponentInChildren <HSRGraspingDetector>(); GameObject moderator = GameObject.FindGameObjectWithTag(TagModerator); // Get grasping candidates this.graspingCandidates = GameObject.FindGameObjectsWithTag(TagGraspingCandidates).ToList <GameObject>(); if (this.graspingCandidates.Count == 0) { throw new Exception("Count of GraspingCandidates is zero."); } // List<GameObject> dummyGraspingCandidates = GameObject.FindGameObjectsWithTag(TagDummyGraspingCandidates).ToList<GameObject>(); this.graspables = new List <GameObject>(); this.graspables.AddRange(this.graspingCandidates); // this.graspables.AddRange(dummyGraspingCandidates); // Check the name conflict of graspables. if (this.graspables.Count != (from graspable in this.graspables select graspable.name).Distinct().Count()) { throw new Exception("There is the name conflict of graspable objects."); } SIGVerseLogger.Info("Count of Graspables = " + this.graspables.Count); this.bedRoomArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameBedRoom); this.kitchenArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameKitchen); this.livingArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameLiving); this.lobbyArea = GameObject.Find(this.environmentName + "/RoomArea/" + AreaNameLobby); // Get grasping candidates positions this.graspingCandidatesPositions = GameObject.FindGameObjectsWithTag(TagGraspingCandidatesPosition).ToList <GameObject>(); if (this.graspables.Count > this.graspingCandidatesPositions.Count) { throw new Exception("graspables.Count > graspingCandidatesPositions.Count."); } else { SIGVerseLogger.Info("Count of GraspingCandidatesPosition = " + this.graspingCandidatesPositions.Count); } this.destinationCandidates = GameObject.FindGameObjectsWithTag(TagDestinationCandidates).ToList <GameObject>(); this.destinationCandidates.Add(moderator); // Treat moderator as a destination candidate if (this.destinationCandidates.Count == 0) { throw new Exception("Count of DestinationCandidates is zero."); } // Check the name conflict of destination candidates. if (this.destinationCandidates.Count != (from destinations in this.destinationCandidates select destinations.name).Distinct().Count()) { throw new Exception("There is the name conflict of destination candidates objects."); } SIGVerseLogger.Info("Count of Destinations = " + this.destinationCandidates.Count); this.avatarMotionPlayer = avatarMotionPlayback.GetComponent <HandymanAvatarMotionPlayer>(); this.avatarMotionRecorder = avatarMotionPlayback.GetComponent <HandymanAvatarMotionRecorder>(); this.playbackRecorder = worldPlayback.GetComponent <HandymanPlaybackRecorder>(); }