// Token: 0x060006CA RID: 1738 RVA: 0x00025DC5 File Offset: 0x00023FC5 public DoorState(GhostAI ghostAI, GhostInteraction ghostInteraction, GhostInfo ghostInfo, PhotonObjectInteract obj) { this.ghostAI = ghostAI; this.ghostInteraction = ghostInteraction; this.ghostInfo = ghostInfo; this.door = obj.GetComponent <Door>(); }
public void SetGhostFrom(bool ghostFrom) { if (GhostArray != null) { return; } if (!ghostFrom) { return; } GhostFreeIndex = GhostZeroUpdateIndex = 0; GhostArray = new GhostInfo[MaxGhostCount]; GhostRefs = new GhostInfo[MaxGhostCount]; for (var i = 0U; i < MaxGhostCount; ++i) { GhostRefs[i] = new GhostInfo { Obj = null, Index = i, UpdateMask = 0UL }; } }
public void DetachObject(GhostInfo info) { info.Flags |= (uint)GhostInfoFlags.KillGhost; if (info.UpdateMask == 0UL) { info.UpdateMask = 0xFFFFFFFFFFFFFFFFUL; GhostPushNonZero(info); } if (info.Obj == null) { return; } if (info.PrevObjectRef != null) { info.PrevObjectRef.NextObjectRef = info.NextObjectRef; } else { info.Obj.SetFirstObjectRef(info.NextObjectRef); } if (info.NextObjectRef != null) { info.NextObjectRef.PrevObjectRef = info.PrevObjectRef; } info.PrevObjectRef = info.NextObjectRef = null; info.Obj = null; }
public NetObject() { _netIndex = 0xFFFFFFFFU; _firstObjectRef = null; _prevDirtyList = null; _nextDirtyList = null; _dirtyMaskBits = 0UL; }
public override void OnEnable() { base.OnEnable(); try { m_GhostInfo = JsonUtility.FromJson <GhostInfo>(File.ReadAllText(AssetDatabase.GetAssetPath(assetTarget))); } catch { m_GhostInfo = default(GhostInfo); } var assetTargetName = assetTarget == null ? "" : assetTarget.name; if (m_GhostInfo.snapshotDataPath == null) { m_GhostInfo.snapshotDataPath = assetTargetName + "SnapshotData.cs"; } if (m_GhostInfo.spawnSystemPath == null) { m_GhostInfo.spawnSystemPath = assetTargetName + "GhostSpawnSystem.cs"; } if (m_GhostInfo.updateSystemPath == null) { m_GhostInfo.updateSystemPath = assetTargetName + "GhostUpdateSystem.cs"; } if (m_GhostInfo.serializerPath == null) { m_GhostInfo.serializerPath = assetTargetName + "GhostSerializer.cs"; } if (m_GhostInfo.importance == null) { m_GhostInfo.importance = "1"; } if (m_GhostInfo.components == null) { m_GhostInfo.components = new GhostComponent[0]; } for (int i = 0; i < m_GhostInfo.components.Length; ++i) { if (m_GhostInfo.components[i].name == null) { m_GhostInfo.components[i].name = ""; } if (m_GhostInfo.components[i].fields == null) { m_GhostInfo.components[i].fields = new GhostField[0]; } for (int j = 0; j < m_GhostInfo.components[i].fields.Length; ++j) { if (m_GhostInfo.components[i].fields[j].name == null) { m_GhostInfo.components[i].fields[j].name = ""; } } } }
protected void FreeGhostInfo(GhostInfo ghost) { if (ghost.ArrayIndex < GhostZeroUpdateIndex) { ghost.UpdateMask = 0UL; GhostPushToZero(ghost); } GhostPushZeroToFree(ghost); }
void SpawnGhost(PlayerTrain playerTrain, Vector3 side) { GhostInfo info = new GhostInfo(); GameObject newGhost = Instantiate(ghostPrefab) as GameObject; newGhost.GetComponent <GhostController> ().feature = this; info.obj = newGhost; int wagonsCount = 0; for (int childIndex = 0; childIndex < playerTrain.transform.childCount; childIndex++) { if (playerTrain.transform.GetChild(childIndex).GetComponent <WagonScript>() != null) { wagonsCount += 1; } } WagonScript wagon = null; Transform spawnPoint = null; for (int wagonIndex = 0; wagonIndex < wagonsCount; wagonIndex++) { // try to get random wagon point wagon = playerTrain.GetWagon(Random.Range(0, wagonsCount)); spawnPoint = wagon.GetGhostPoint(); if (spawnPoint != null) { info.wagonIndex = wagon.GetIndex(); break; } wagon = playerTrain.GetWagon(wagonIndex); spawnPoint = wagon.GetGhostPoint(); if (spawnPoint != null) { info.wagonIndex = wagon.GetIndex(); break; } } //GameObject wagon = playerTrain.GetWagon (Random.Range(0,wagonsCount)).gameObject; if (spawnPoint == null) { return; } newGhost.transform.parent = spawnPoint; newGhost.transform.localPosition = new Vector3(0, 0, 0); newGhost.transform.localScale = new Vector3(1, 1, 1); newGhost.transform.localEulerAngles = side; newGhost.GetComponent <Animator>().Play("move"); spawnedGhosts.Add(info); }
public void GhostPushNonZero(GhostInfo info) { if (info.ArrayIndex != GhostZeroUpdateIndex) { GhostArray[GhostZeroUpdateIndex].ArrayIndex = info.ArrayIndex; GhostArray[info.ArrayIndex] = GhostArray[GhostZeroUpdateIndex]; GhostArray[GhostZeroUpdateIndex] = info; info.ArrayIndex = GhostZeroUpdateIndex; } ++GhostZeroUpdateIndex; }
public void GhostPushZeroToFree(GhostInfo info) { --GhostFreeIndex; if (info.ArrayIndex != GhostFreeIndex) { GhostArray[GhostFreeIndex].ArrayIndex = info.ArrayIndex; GhostArray[info.ArrayIndex] = GhostArray[GhostFreeIndex]; GhostArray[GhostFreeIndex] = info; info.ArrayIndex = GhostFreeIndex; } }
public void GhostPushFreeToZero(GhostInfo info) { if (info.ArrayIndex != GhostFreeIndex) { GhostArray[GhostFreeIndex].ArrayIndex = info.ArrayIndex; GhostArray[info.ArrayIndex] = GhostArray[GhostFreeIndex]; GhostArray[GhostFreeIndex] = info; info.ArrayIndex = GhostFreeIndex; } ++GhostFreeIndex; }
public void GhostPushToZero(GhostInfo info) { --GhostZeroUpdateIndex; if (info.ArrayIndex == GhostZeroUpdateIndex) { return; } GhostArray[GhostZeroUpdateIndex].ArrayIndex = info.ArrayIndex; GhostArray[info.ArrayIndex] = GhostArray[GhostZeroUpdateIndex]; GhostArray[GhostZeroUpdateIndex] = info; info.ArrayIndex = GhostZeroUpdateIndex; }
void SpawnGhost(PlayerTrain playerTrain, Vector3 side) { GhostInfo info = new GhostInfo (); GameObject newGhost = Instantiate (ghostPrefab) as GameObject; newGhost.GetComponent<GhostController> ().feature = this; info.obj = newGhost; int wagonsCount = 0; for(int childIndex = 0; childIndex < playerTrain.transform.childCount; childIndex++) { if (playerTrain.transform.GetChild(childIndex).GetComponent<WagonScript>() != null) { wagonsCount += 1; } } WagonScript wagon = null; Transform spawnPoint = null; for (int wagonIndex = 0; wagonIndex < wagonsCount; wagonIndex++) { // try to get random wagon point wagon = playerTrain.GetWagon (Random.Range(0,wagonsCount)); spawnPoint = wagon.GetGhostPoint (); if (spawnPoint != null) { info.wagonIndex = wagon.GetIndex (); break; } wagon = playerTrain.GetWagon (wagonIndex); spawnPoint = wagon.GetGhostPoint (); if (spawnPoint != null) { info.wagonIndex = wagon.GetIndex (); break; } } //GameObject wagon = playerTrain.GetWagon (Random.Range(0,wagonsCount)).gameObject; if (spawnPoint == null) return; newGhost.transform.parent = spawnPoint; newGhost.transform.localPosition = new Vector3(0,0,0); newGhost.transform.localScale = new Vector3(1,1,1); newGhost.transform.localEulerAngles = side; newGhost.GetComponent<Animator>().Play("move"); spawnedGhosts.Add (info); }
/* * void OnDisable() { * _ghostInfos.Clear(); * } */ GhostInfo NewGhostInfo() { for (int i = 0; i < _ghostInfos.Count; i++) { if (!_ghostInfos[i]._used) { _ghostInfos[i]._used = true; return(_ghostInfos[i]); } } GhostInfo info = new GhostInfo(); info._mesh = new Mesh(); info._matBlock = new MaterialPropertyBlock(); info._used = true; _ghostInfos.Add(info); return(info); }
// Token: 0x0600075A RID: 1882 RVA: 0x0002AF74 File Offset: 0x00029174 public bool IsFingerPrintEvidence() { GhostInfo ghostInfo = LevelController.instance.currentGhost.ghostInfo; return(ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Wraith || ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Poltergeist || ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Spirit || ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Banshee || ghostInfo.ghostTraits.ghostType == GhostTraits.Type.Revenant); }
void PlaySoundEffect() { GI = AG.gameObject.GetComponentInChildren <GhostInfo> (); SoundEffect = GI.OnActiveAudio[Random.Range(0, 3)]; Audio.PlayOneShot(SoundEffect); }
void PlaySoundEffect() { GI = AG.gameObject.GetComponentInChildren<GhostInfo> (); SoundEffect = GI.OnActiveAudio[Random.Range (0, 3)]; Audio.PlayOneShot (SoundEffect); }
} // Dummy constructor public u0920u0920u0929u0924u091Fu0928u0926u091Eu0923u0921u091F(GhostAI ghostAI, GhostInteraction ghostInteraction, GhostInfo ghostInfo, PhotonObjectInteract obj) { } // 0x0000000180C7F090-0x0000000180C7F150
// gets move information, for drawing ghosts and for performing actual move operation private GhostInfo[] GetMoveGhostInfo(Matrix worldToView, TimelineLayout layout) { // get start and y offsets in timeline space PointF dragOffset = GetDragOffset(); // Get snapping points along the timeline (in world coordinates). List<float> movingPoints = new List<float>(2); TimelinePath snapperPath; if (m_mouseMoveHitRecord != null) snapperPath = m_mouseMoveHitRecord.HitPath;//use the last clicked event (interval, key or marker) else snapperPath = m_owner.Selection.LastSelected as TimelinePath;//moving a group or track, for example IEvent snapperEvent = snapperPath != null ? snapperPath.Last as IEvent : null; if (snapperEvent != null) { Matrix localToWorld = D2dTimelineControl.CalculateLocalToWorld(snapperPath); float worldStart = GdiUtil.Transform(localToWorld, snapperEvent.Start + dragOffset.X); movingPoints.Add(worldStart); if (snapperEvent.Length > 0.0f) movingPoints.Add(GdiUtil.Transform(localToWorld, snapperEvent.Start + dragOffset.X + snapperEvent.Length)); } // Get the offset from one of the world snap points to the closest non-selected object. float snapOffset; try { s_snapOptions.FilterContext = snapperEvent; s_snapOptions.Filter = new D2dTimelineControl.SnapFilter(MoveSnapFilter); snapOffset = m_owner.GetSnapOffset(movingPoints, s_snapOptions); } finally { s_snapOptions.FilterContext = null; s_snapOptions.Filter = null; } // adjust dragOffset to "snap-to" nearest event dragOffset.X += snapOffset; // get offsets in client space float xOffset = dragOffset.X * worldToView.Elements[0]; float yOffset = dragOffset.Y * worldToView.Elements[3]; TimelinePath[] targets = GetMoveTargets(layout); // Pretend that drag-drop objects are in the TimelineLayout object if (m_owner.DragDropObjects != null) { foreach (ITimelineObject dragDrop in m_owner.DragDropObjects) layout[dragDrop] = GetDragDropBounds(dragDrop); } GhostInfo[] ghosts = new GhostInfo[targets.Length]; int i = -1; foreach(TimelinePath path in m_owner.Selection.Selection) { i++; ITimelineObject timelineObject = path.Last; RectangleF bounds = layout[path]; TimelinePath targetPath = targets[i]; ITimelineObject target = targetPath != null ? targetPath.Last : null; float start = 0; float length = 0; bool valid = true; IInterval interval = timelineObject as IInterval; IKey key = timelineObject as IKey; IMarker marker = timelineObject as IMarker; ITrack track = timelineObject as ITrack; IGroup group = timelineObject as IGroup; ITimelineReference reference = timelineObject as ITimelineReference; if (interval != null) { ITrack targetTrack = target as ITrack; start = interval.Start + dragOffset.X; length = interval.Length; valid = targetTrack != null; valid &= m_owner.Constraints.IsStartValid(interval, ref start); valid &= m_owner.Constraints.IsLengthValid(interval, ref length); if (valid) { ITrack intervalTrack = interval.Track; if (intervalTrack != null) yOffset = layout[target].Y - layout[interval.Track].Y; else yOffset = layout[target].Y - bounds.Y; TimelinePath testPath = new TimelinePath(targetPath); foreach (IInterval other in targetTrack.Intervals) { // skip selected intervals, since they are moving too testPath.Last = other; if (m_owner.Selection.SelectionContains(testPath)) continue; if (!m_owner.Constraints.IsIntervalValid(interval, ref start, ref length, other)) { valid = false; break; } } } } else if (reference != null) { // don't allow for vertical repositioning yet start = reference.Start + dragOffset.X; valid = true; } else if (key != null) { start = key.Start + dragOffset.X; ITrack targetTrack = target as ITrack; valid = targetTrack != null; valid &= m_owner.Constraints.IsStartValid(key, ref start); if (valid) { ITrack keyTrack = key.Track; if (keyTrack != null) yOffset = layout[targetTrack].Y - layout[key.Track].Y; else yOffset = layout[targetTrack].Y - bounds.Y; } } else if (marker != null) { start = marker.Start + dragOffset.X; yOffset = 0; valid = m_owner.Constraints.IsStartValid(marker, ref start); } else if (track != null) { xOffset = 0; if (target == null) { target = (DragDelta.Y < 0) ? GetLastTrack() : GetFirstTrack(); } } else if (group != null) { xOffset = 0; if (target == null) { IList<IGroup> groups = m_owner.TimelineDocument.Timeline.Groups; target = (DragDelta.Y < 0) ? groups[0] : groups[groups.Count - 1]; } } bounds.Offset(xOffset, yOffset); ghosts[i] = new GhostInfo(timelineObject, target, start, length, bounds, valid); } return ghosts; }
public void SetFirstObjectRef(GhostInfo info) { _firstObjectRef = info; }
// Token: 0x06000973 RID: 2419 RVA: 0x00039850 File Offset: 0x00037A50 public void OnPhraseRecognized(string args) { if (!this.inUse) { return; } if (LevelController.instance.currentPlayerRoom == null || LevelController.instance.currentGhostRoom == null) { return; } if (LevelController.instance.currentPlayerRoom == LevelController.instance.outsideRoom) { return; } if (Vector3.Distance(base.transform.position, GameController.instance.myPlayer.player.headObject.transform.position) > 5f) { return; } if (!XRDevice.isPresent && PlayerPrefs.GetInt("localPushToTalkValue") == 0 && PhotonNetwork.room.PlayerCount > 1 && !GameController.instance.myPlayer.player.pcPushToTalk.isPressingPushToTalk) { return; } if (Random.Range(0, 3) == 1 && PlayerPrefs.GetInt("isYoutuberVersion") == 0) { for (int i = 0; i < LevelController.instance.currentPlayerRoom.lightSwitches.Count; i++) { LevelController.instance.currentPlayerRoom.lightSwitches[i].view.RPC("FlickerNetworked", PhotonTargets.All, Array.Empty <object>()); } if (SetupPhaseController.instance.isSetupPhase) { SetupPhaseController.instance.ForceEnterHuntingPhase(); } GameController.instance.myPlayer.player.insanity += 40f; this.Use(); return; } for (int j = 0; j < this.questions.Count; j++) { for (int k = 0; k < this.questions[j].questions.Count; k++) { if (args == this.questions[j].questions[k]) { switch (this.questions[j].answerType) { case Question.AnswerType.dead: this.view.RPC("DeadAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); break; case Question.AnswerType.roomAmount: this.view.RPC("RoomAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); break; case Question.AnswerType.location: this.view.RPC("LocationAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); break; case Question.AnswerType.age: this.view.RPC("AgeAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); break; } if (LevelController.instance.currentGhost.ghostInfo.ghostTraits.ghostType != GhostTraits.Type.Demon) { GameController.instance.myPlayer.player.insanity += Random.Range(5f, 10f); } return; } } } for (int l = 0; l < this.yesOrNoQuestions.Count; l++) { for (int m = 0; m < this.yesOrNoQuestions[l].questions.Count; m++) { if (args == this.yesOrNoQuestions[l].questions[m]) { if (Random.Range(0, 3) == 2) { this.view.RPC("MaybeAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); } else { GhostInfo ghostInfo = LevelController.instance.currentGhost.ghostInfo; if (this.yesOrNoQuestions[l].questionType == YesNoMaybeQuestion.QuestionType.location) { if (Vector3.Distance(ghostInfo.transform.position, base.transform.position) < 3f) { this.view.RPC("NoAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); } else { this.view.RPC("YesAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); } } else { this.view.RPC("MaybeAnswer", PhotonNetwork.masterClient, Array.Empty <object>()); } } if (LevelController.instance.currentGhost.ghostInfo.ghostTraits.ghostType != GhostTraits.Type.Demon) { GameController.instance.myPlayer.player.insanity += Random.Range(5f, 10f); } return; } } } }
public void SnapLegacyGhost(float currentTime) { float sqrDist = snapDistance * snapDistance; Vector3 rhPos = rightHand.position, lhPos = leftHand.position, rfPos = rightFoot.position, lfPos = leftFoot.position, wsPos = waist.position; if ((rhPos - rightHandPos).sqrMagnitude < sqrDist && (lhPos - leftHandPos).sqrMagnitude < sqrDist && (rfPos - rightFootPos).sqrMagnitude < sqrDist && (lfPos - leftFootPos).sqrMagnitude < sqrDist && (wsPos - waistPos).sqrMagnitude < sqrDist) { return; } rightHandPos = rhPos; leftHandPos = lhPos; rightFootPos = rfPos; leftFootPos = lfPos; waistPos = wsPos; bool overFlowed = false; GhostInfo gi = null; //var mesh = Snap(); if (ghosts.Count >= maxGhostsCount) { overFlowed = true; gi = ghosts[0]; ghosts.RemoveAt(0); ghosts.Add(gi); } else { gi = ghostPool.Dequeue(); ghosts.Add(gi); gi.snappedObject.SetActive(true); } /* * GameObject go = gi.snappedObject; * MeshFilter mf = go.GetComponent<MeshFilter>(); * MeshRenderer mr = go.GetComponent<MeshRenderer>(); * * mf.sharedMesh = mesh; * mr.sharedMaterials = materialList; * gi.mesh = mesh;*/ Snap(gi.mesh); var sot = gi.snappedObject.transform; sot.position = transform.position; sot.rotation = transform.rotation; sot.localScale = transform.localScale; gi.snapTime = currentTime; lastGhost = gi; if (overFlowed) { float earliestTime = currentTime - lifeTime; float timeStep = (float)lifeTime / (float)(ghosts.Count); for (int i = 0; i < ghosts.Count; i++) { ghosts[i].snapTime = earliestTime + ((i + 1) * timeStep); } } }
void LateUpdate() { #if UNITY_EDITOR /* * for (int i = 0; i < _materals.Length; i++) { * _materals[i].SetInt("_SrcBlend", (int)_srcBlendMode); * _materals[i].SetInt("_DstBlend", (int)_dstBlendMode); * } */ #endif if (GenerateEnabled && Time.time - _lastCreateTime > _intervalTime) { if (Vector3.SqrMagnitude(transform.position - _lastPostion) > _minDistance * _minDistance) { _lastCreateTime = Time.time; GhostInfo info = NewGhostInfo(); if (_skinnedMeshRenderer != null) { _skinnedMeshRenderer.BakeMesh(info._mesh); } else { info._mesh = _sharedMesh; } info._pos = transform.position; info._matrix = transform.localToWorldMatrix; info._life = _lifeTime; _lastPostion = transform.position; if (!_firstCreate) { _firstCreate = true; } } } bool noneUsed = true; for (int i = _ghostInfos.Count - 1; i >= 0; i--) { GhostInfo info = _ghostInfos[i]; info._life -= Time.deltaTime; if (info._life < 0) { info._used = false; } else { noneUsed = false; //Color c = _rimColor; //c.a *= info._life / _lifeTime; //info._matBlock.SetColor("_RimColor", c); if (!string.IsNullOrEmpty(_colorKey)) { Color c = _material.GetColor(_colorKey); c.a *= info._life / _lifeTime; info._matBlock.SetColor(_colorKey, c); } } } if (_ghostInfos.Count > 0 && noneUsed) { _lastPostion = new Vector3(Mathf.NegativeInfinity, Mathf.NegativeInfinity, Mathf.NegativeInfinity); } if (_firstCreate && noneUsed) { GenerateFinished = true; } for (int i = 0; i < _ghostInfos.Count; i++) { GhostInfo info = _ghostInfos[i]; if (info._used) { if (Vector3.SqrMagnitude(info._pos - transform.position) > 0.25f) { int lenght = _renderer.sharedMaterials.Length; int subMesh = Mathf.Min(info._mesh.subMeshCount, lenght); for (int j = 0; j < subMesh; j++) { Graphics.DrawMesh(info._mesh, info._matrix, _material, gameObject.layer, null, j, info._matBlock); } } } } }
private void _MoveSelection(bool tryToCopy, bool createTracksAndGroups) { ITimeline timeline = m_owner.TimelineDocument.Timeline; Dictionary <ITrack, ITrack> newTrackMap = new Dictionary <ITrack, ITrack>(); List <Sce.Atf.Pair <ITrack, IEvent> > toAdd = new List <Sce.Atf.Pair <ITrack, IEvent> >(); for (int i = 0; i < m_ghosts.Length; i++) { GhostInfo ghost = m_ghosts[i]; ITimelineObject ghostCopy = null; if (tryToCopy) { ICloneable cloneable = ghost.Object as ICloneable; if (cloneable != null) { ghostCopy = cloneable.Clone() as ITimelineObject; } } ITimelineReference reference = ghost.Object as ITimelineReference; if (reference != null) { if (ghostCopy != null) { reference = (ITimelineReference)ghostCopy; } reference.Start = ghost.Start; if (ghostCopy != null && timeline is IHierarchicalTimelineList) { ((IHierarchicalTimelineList)timeline).References.Add(reference); } continue; } IInterval interval = ghost.Object as IInterval; if (interval != null) { if (ghostCopy != null) { interval = (IInterval)ghostCopy; } interval.Start = ghost.Start; interval.Length = ghost.Length; ITrack target = (ITrack)ghost.Target; if (target != interval.Track && createTracksAndGroups) { if (target == null) { target = CreateTargetTrack(interval.Track, newTrackMap); } if (ghostCopy == null) { interval.Track.Intervals.Remove(interval); } toAdd.Add(new Sce.Atf.Pair <ITrack, IEvent>(target, interval)); } continue; } IKey key = ghost.Object as IKey; if (key != null) { if (ghostCopy != null) { key = (IKey)ghostCopy; } key.Start = ghost.Start; ITrack target = (ITrack)ghost.Target; if (target != key.Track && createTracksAndGroups) { if (target == null) { target = CreateTargetTrack(key.Track, newTrackMap); } if (ghostCopy == null) { key.Track.Keys.Remove(key); } toAdd.Add(new Sce.Atf.Pair <ITrack, IEvent>(target, key)); } continue; } IMarker marker = ghost.Object as IMarker; if (marker != null) { if (ghost.Valid && marker.Start != ghost.Start) { if (ghostCopy != null) { IMarker markerCopy = (IMarker)ghostCopy; markerCopy.Start = ghost.Start; marker.Timeline.Markers.Add(markerCopy); } else { marker.Start = ghost.Start; } } continue; } ITrack track = ghost.Object as ITrack; if (track != null) { var targetTrack = ghost.Target as ITrack; if (targetTrack != null && targetTrack != track) { if (ghostCopy != null) { track = (ITrack)ghostCopy; } int index = targetTrack.Group.Tracks.IndexOf(targetTrack); if (ghostCopy == null) { track.Group.Tracks.Remove(track); } targetTrack.Group.Tracks.Insert(index, track); } else { var targetGroup = ghost.Target as IGroup; if (targetGroup != null) { // the track was dragged to an empty group. http://tracker.ship.scea.com/jira/browse/WWSATF-1371 if (ghostCopy != null) { track = (ITrack)ghostCopy; } else { track.Group.Tracks.Remove(track); } targetGroup.Tracks.Insert(0, track); } } continue; } IGroup group = ghost.Object as IGroup; if (group != null) { IGroup target = (IGroup)ghost.Target; if (target != null && target != group) { if (ghostCopy != null) { group = (IGroup)ghostCopy; } int index = m_owner.TimelineDocument.Timeline.Groups.IndexOf(target); if (ghostCopy == null) { m_owner.TimelineDocument.Timeline.Groups.Remove(group); } m_owner.TimelineDocument.Timeline.Groups.Insert(index, group); } continue; } } // So that when multiple intervals from multiple tracks are relocated to a different // set of tracks, we need to remove them all and then add them all. If the remove and // adds are done in pairs, one by one, then the events can step on each other. artf32260 foreach (Sce.Atf.Pair <ITrack, IEvent> trackEventPair in toAdd) { if (trackEventPair.Second is IInterval) { trackEventPair.First.Intervals.Add((IInterval)trackEventPair.Second); } else { trackEventPair.First.Keys.Add((IKey)trackEventPair.Second); } } }
// gets move information, for drawing ghosts and for performing actual move operation private GhostInfo[] GetMoveGhostInfo(Matrix worldToView, TimelineLayout layout) { // get start and y offsets in timeline space PointF dragOffset = GetDragOffset(); // Get snapping points along the timeline (in world coordinates). List <float> movingPoints = new List <float>(2); TimelinePath snapperPath; if (m_mouseMoveHitRecord != null) { snapperPath = m_mouseMoveHitRecord.HitPath;//use the last clicked event (interval, key or marker) } else { snapperPath = m_owner.Selection.LastSelected as TimelinePath;//moving a group or track, for example } IEvent snapperEvent = snapperPath != null ? snapperPath.Last as IEvent : null; if (snapperEvent != null) { Matrix localToWorld = D2dTimelineControl.CalculateLocalToWorld(snapperPath); float worldStart = GdiUtil.Transform(localToWorld, snapperEvent.Start + dragOffset.X); movingPoints.Add(worldStart); if (snapperEvent.Length > 0.0f) { movingPoints.Add(GdiUtil.Transform(localToWorld, snapperEvent.Start + dragOffset.X + snapperEvent.Length)); } } // Get the offset from one of the world snap points to the closest non-selected object. float snapOffset; try { s_snapOptions.FilterContext = snapperEvent; s_snapOptions.Filter = new D2dTimelineControl.SnapFilter(MoveSnapFilter); snapOffset = m_owner.GetSnapOffset(movingPoints, s_snapOptions); } finally { s_snapOptions.FilterContext = null; s_snapOptions.Filter = null; } // adjust dragOffset to "snap-to" nearest event dragOffset.X += snapOffset; // get offsets in client space float xOffset = dragOffset.X * worldToView.Elements[0]; float yOffset = dragOffset.Y * worldToView.Elements[3]; TimelinePath[] targets = GetMoveTargets(layout); // Pretend that drag-drop objects are in the TimelineLayout object if (m_owner.DragDropObjects != null) { foreach (ITimelineObject dragDrop in m_owner.DragDropObjects) { layout[dragDrop] = GetDragDropBounds(dragDrop); } } GhostInfo[] ghosts = new GhostInfo[targets.Length]; int i = -1; foreach (TimelinePath path in m_owner.Selection.Selection) { i++; ITimelineObject timelineObject = path.Last; RectangleF bounds = layout[path]; TimelinePath targetPath = targets[i]; ITimelineObject target = targetPath != null ? targetPath.Last : null; float start = 0; float length = 0; bool valid = true; IInterval interval = timelineObject as IInterval; IKey key = timelineObject as IKey; IMarker marker = timelineObject as IMarker; ITrack track = timelineObject as ITrack; IGroup group = timelineObject as IGroup; ITimelineReference reference = timelineObject as ITimelineReference; if (interval != null) { ITrack targetTrack = target as ITrack; start = interval.Start + dragOffset.X; length = interval.Length; valid = targetTrack != null; valid &= m_owner.Constraints.IsStartValid(interval, ref start); valid &= m_owner.Constraints.IsLengthValid(interval, ref length); if (valid) { ITrack intervalTrack = interval.Track; if (intervalTrack != null) { yOffset = layout[target].Y - layout[interval.Track].Y; } else { yOffset = layout[target].Y - bounds.Y; } TimelinePath testPath = new TimelinePath(targetPath); foreach (IInterval other in targetTrack.Intervals) { // skip selected intervals, since they are moving too testPath.Last = other; if (m_owner.Selection.SelectionContains(testPath)) { continue; } if (!m_owner.Constraints.IsIntervalValid(interval, ref start, ref length, other)) { valid = false; break; } } } } else if (reference != null) { // don't allow for vertical repositioning yet start = reference.Start + dragOffset.X; valid = true; } else if (key != null) { start = key.Start + dragOffset.X; ITrack targetTrack = target as ITrack; valid = targetTrack != null; valid &= m_owner.Constraints.IsStartValid(key, ref start); if (valid) { ITrack keyTrack = key.Track; if (keyTrack != null) { yOffset = layout[targetTrack].Y - layout[key.Track].Y; } else { yOffset = layout[targetTrack].Y - bounds.Y; } } } else if (marker != null) { start = marker.Start + dragOffset.X; yOffset = 0; valid = m_owner.Constraints.IsStartValid(marker, ref start); } else if (track != null) { xOffset = 0; if (target == null) { target = (DragDelta.Y < 0) ? GetLastTrack() : GetFirstTrack(); } } else if (group != null) { xOffset = 0; if (target == null) { IList <IGroup> groups = m_owner.TimelineDocument.Timeline.Groups; target = (DragDelta.Y < 0) ? groups[0] : groups[groups.Count - 1]; } } bounds.Offset(xOffset, yOffset); ghosts[i] = new GhostInfo(timelineObject, target, start, length, bounds, valid); } return(ghosts); }
private void Initial() { usedShader = Shader.Find(shaderName); smrs = new List <SkinnedMeshRenderer>(GetComponentsInChildren <SkinnedMeshRenderer>()); List <Material> matList = new List <Material>(); Dictionary <Material, Material> origToInstMatDict = new Dictionary <Material, Material>(); if (LGObject) { Destroy(LGObject, lifeTime); } LGObject = new GameObject("_LegacyGhosting:" + gameObject.name); LGObject.layer = gameObject.layer; for (int i = 0; i < maxGhostsCount; i++) { var gi = new GhostInfo(); var go = new GameObject("_SnappedGhost"); go.transform.parent = LGObject.transform; go.layer = LGObject.layer; var giMeshList = new List <Mesh>(); foreach (var smr in smrs) { var m = smr.sharedMesh; var mats = new List <Material>(); for (int j = 0; j < m.subMeshCount; j++) { var oriMat = smr.sharedMaterials[j]; if (!origToInstMatDict.ContainsKey(oriMat)) { var instMat = new Material(oriMat); if (usedShader) { instMat.shader = usedShader; } origToInstMatDict.Add(oriMat, instMat); } mats.Add(origToInstMatDict[oriMat]); } var child = new GameObject("_mesh:" + smr.name); child.transform.parent = go.transform; child.layer = go.layer; var nmesh = new Mesh(); nmesh.MarkDynamic(); giMeshList.Add(child.AddComponent <MeshFilter>().sharedMesh = nmesh); child.AddComponent <MeshRenderer>().sharedMaterials = mats.ToArray(); } gi.snappedObject = go; gi.mesh = giMeshList.ToArray(); go.SetActive(false); ghostPool.Enqueue(gi); } waist = animator.GetBoneTransform(HumanBodyBones.Hips) ?? transform; leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand) ?? transform; rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand) ?? transform; leftFoot = animator.GetBoneTransform(HumanBodyBones.LeftFoot) ?? transform; rightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot) ?? transform; }
public IEnumerator LoadObjectsTask() { yield return(new WaitForSeconds(0.15f)); Main.missionManager = GameObject.FindObjectOfType <MissionManager>(); yield return(new WaitForSeconds(0.15f));; Main.gameController = GameObject.FindObjectOfType <GameController>(); yield return(new WaitForSeconds(0.15f)); Main.levelController = GameObject.FindObjectOfType <LevelController>(); yield return(new WaitForSeconds(0.15f));; Main.levelSelectionManager = GameObject.FindObjectOfType <LevelSelectionManager>(); yield return(new WaitForSeconds(0.15f)); Main.walkieTalkie = GameObject.FindObjectOfType <WalkieTalkie>(); yield return(new WaitForSeconds(0.15f)); Main.handCamera = GameObject.FindObjectOfType <HandCamera>(); yield return(new WaitForSeconds(0.15f)); Main.inventoryManager = GameObject.FindObjectOfType <InventoryManager>(); yield return(new WaitForSeconds(0.15f)); Main.liftButton = GameObject.FindObjectOfType <LiftButton>(); yield return(new WaitForSeconds(0.15f)); Main.contract = GameObject.FindObjectOfType <Contract>(); yield return(new WaitForSeconds(0.15f)); Main.pCMenu = GameObject.FindObjectOfType <PCMenu>(); yield return(new WaitForSeconds(0.15f)); Main.exitLevel = GameObject.FindObjectOfType <ExitLevel>(); yield return(new WaitForSeconds(0.15f)); Main.ghostAI = UnityEngine.Object.FindObjectOfType <GhostAI>(); yield return(new WaitForSeconds(0.15f)); Main.lightSwitch = GameObject.FindObjectOfType <LightSwitch>(); yield return(new WaitForSeconds(0.15f)); Main.light = GameObject.FindObjectOfType <Light>(); yield return(new WaitForSeconds(0.15f)); Main.dNAEvidences = Enumerable.ToList <DNAEvidence>(GameObject.FindObjectsOfType <DNAEvidence>()); yield return(new WaitForSeconds(0.15f)); Main.contracts = Enumerable.ToList <Contract>(GameObject.FindObjectsOfType <Contract>()); yield return(new WaitForSeconds(0.15f)); Main.items = Enumerable.ToList <InventoryItem>(GameObject.FindObjectsOfType <InventoryItem>()); yield return(new WaitForSeconds(0.15f)); Main.players = Enumerable.ToList <Player>(GameObject.FindObjectsOfType <Player>()); yield return(new WaitForSeconds(0.15f)); if (Main.levelController != null) { Main.photonView = (Main.ghostAI.field_Public_PhotonView_0 ?? null); yield return(new WaitForSeconds(0.15f)); } Main.ghostInfo = GameObject.FindObjectOfType <GhostInfo>(); yield return(new WaitForSeconds(0.15f)); Main.deadPlayer = GameObject.FindObjectOfType <DeadPlayer>(); yield return(new WaitForSeconds(0.15f)); Main.player = GameObject.FindObjectOfType <Player>(); yield return(new WaitForSeconds(0.15f)); Main.rigidbody = GameObject.FindObjectOfType <Rigidbody>(); yield return(new WaitForSeconds(0.15f)); Main.itemSpawner = GameObject.FindObjectOfType <ItemSpawner>(); yield return(new WaitForSeconds(0.15f)); Main.ghostInteraction = GameObject.FindObjectOfType <GhostInteraction>(); yield return(new WaitForSeconds(0.15f)); //Main.baseController = GameObject.FindObjectOfType<BaseController>(); yield return(new WaitForSeconds(0.15f)); Main.ouijaBoard = GameObject.FindObjectOfType <OuijaBoard>(); yield return(new WaitForSeconds(0.15f)); Main.ouijaBoards = Enumerable.ToList <OuijaBoard>(GameObject.FindObjectsOfType <OuijaBoard>()); yield return(new WaitForSeconds(0.15f)); Main.keys = Enumerable.ToList <Key>(GameObject.FindObjectsOfType <Key>()); yield return(new WaitForSeconds(0.15f)); Main.ghosts = Enumerable.ToList <GhostAI>(GameObject.FindObjectsOfType <GhostAI>()); yield return(new WaitForSeconds(0.15f)); Main.serverManager = GameObject.FindObjectOfType <ServerManager>(); yield return(new WaitForSeconds(0.15f)); Main.torches = Enumerable.ToList <Torch>(GameObject.FindObjectsOfType <Torch>()); yield return(new WaitForSeconds(0.15f)); Main.ghostAudio = GameObject.FindObjectOfType <GhostAudio>(); yield return(new WaitForSeconds(0.15f)); Main.fuseBox = GameObject.FindObjectOfType <FuseBox>(); yield return(new WaitForSeconds(0.15f)); Main.doors = Enumerable.ToList <Door>(GameObject.FindObjectsOfType <Door>()); yield return(new WaitForSeconds(0.15f)); Main.lightSwitches = Enumerable.ToList <LightSwitch>(GameObject.FindObjectsOfType <LightSwitch>()); if (UnityEngine.Object.FindObjectOfType <Player>() != null) { Main.player = (UnityEngine.Object.FindObjectOfType <Player>() ?? null); yield return(new WaitForSeconds(0.15f)); Main.playerAnim = (Main.player.field_Public_Animator_0 ?? null); yield return(new WaitForSeconds(0.15f)); if (Main.playerAnim != null) { Main.boneTransform = (Main.playerAnim.GetBoneTransform((HumanBodyBones)10) ?? null); yield return(new WaitForSeconds(0.15f)); if (Main.boneTransform != null) { Main.light = (Main.boneTransform.GetComponent <Light>() ?? null); yield return(new WaitForSeconds(0.15f)); } } } yield return(null); yield break; }
public async Task LoadObjectsTask() { string curSceneName = SceneManager.GetActiveScene().name.ToLower(); while (!curSceneName.Contains("menu") && !curSceneName.Contains("new")) { await Task.Delay(4000); if (SceneManager.sceneLoaded != null) { Main.gameController = GameObject.FindObjectOfType <GameController>(); await Task.Delay(150); Main.levelController = GameObject.FindObjectOfType <LevelController>(); await Task.Delay(150); Main.levelSelectionManager = GameObject.FindObjectOfType <LevelSelectionManager>(); await Task.Delay(150); Main.walkieTalkie = GameObject.FindObjectOfType <WalkieTalkie>(); await Task.Delay(150); Main.handCamera = GameObject.FindObjectOfType <HandCamera>(); await Task.Delay(150); Main.inventoryManager = GameObject.FindObjectOfType <InventoryManager>(); await Task.Delay(150); Main.liftButton = GameObject.FindObjectOfType <LiftButton>(); await Task.Delay(150); Main.contract = GameObject.FindObjectOfType <Contract>(); await Task.Delay(150); Main.pCMenu = GameObject.FindObjectOfType <PCMenu>(); await Task.Delay(150); Main.exitLevel = GameObject.FindObjectOfType <ExitLevel>(); await Task.Delay(150); Main.ghostAI = GameObject.FindObjectOfType <GhostAI>(); await Task.Delay(150); Main.lightSwitch = GameObject.FindObjectOfType <LightSwitch>(); await Task.Delay(150); Main.light = GameObject.FindObjectOfType <Light>(); await Task.Delay(150); Main.dNAEvidences = Enumerable.ToList <DNAEvidence>(GameObject.FindObjectsOfType <DNAEvidence>()); await Task.Delay(150); Main.contracts = Enumerable.ToList <Contract>(GameObject.FindObjectsOfType <Contract>()); await Task.Delay(150); Main.items = Enumerable.ToList <InventoryItem>(GameObject.FindObjectsOfType <InventoryItem>()); await Task.Delay(150); Main.players = Enumerable.ToList <Player>(GameObject.FindObjectsOfType <Player>()); await Task.Delay(150); Main.photonView = GameObject.FindObjectOfType <PhotonView>(); await Task.Delay(150); Main.ghostInfo = GameObject.FindObjectOfType <GhostInfo>(); await Task.Delay(150); Main.deadPlayer = GameObject.FindObjectOfType <DeadPlayer>(); await Task.Delay(150); Main.player = GameObject.FindObjectOfType <Player>(); await Task.Delay(150); Main.rigidbody = GameObject.FindObjectOfType <Rigidbody>(); await Task.Delay(150); Main.itemSpawner = GameObject.FindObjectOfType <ItemSpawner>(); await Task.Delay(150); Main.ghostInteraction = GameObject.FindObjectOfType <GhostInteraction>(); await Task.Delay(150); //Main.baseController = GameObject.FindObjectOfType<BaseController>(); await Task.Delay(150); Main.ouijaBoard = GameObject.FindObjectOfType <OuijaBoard>(); await Task.Delay(150); Main.ouijaBoards = Enumerable.ToList <OuijaBoard>(GameObject.FindObjectsOfType <OuijaBoard>()); await Task.Delay(150); Main.keys = Enumerable.ToList <Key>(GameObject.FindObjectsOfType <Key>()); await Task.Delay(150); Main.ghosts = Enumerable.ToList <GhostAI>(GameObject.FindObjectsOfType <GhostAI>()); await Task.Delay(150); Main.serverManager = GameObject.FindObjectOfType <ServerManager>(); await Task.Delay(150); Main.torches = Enumerable.ToList <Torch>(GameObject.FindObjectsOfType <Torch>()); await Task.Delay(150); Main.ghostAudio = GameObject.FindObjectOfType <GhostAudio>(); await Task.Delay(150); Main.fuseBox = GameObject.FindObjectOfType <FuseBox>(); await Task.Delay(150); Main.doors = Enumerable.ToList <Door>(GameObject.FindObjectsOfType <Door>()); await Task.Delay(150); Main.lightSwitches = Enumerable.ToList <LightSwitch>(GameObject.FindObjectsOfType <LightSwitch>()); } } }
/// <summary> /// Creates and caches resize information, for drawing ghosts and for performing /// actual resize operations</summary> /// <param name="layout">TimelineLayout</param> /// <param name="worldDrag">Drag offset</param> /// <param name="worldToView">World to view transformation matrix</param> /// <returns>Array of GhostInfo</returns> internal GhostInfo[] CreateGhostInfo(TimelineLayout layout, float worldDrag, Matrix worldToView) { // Get snap-from point in world coordinates. float[] movingPoints = new[] { worldDrag + m_originalBoundary }; float snapOffset = m_owner.GetSnapOffset(movingPoints, null); // adjust dragOffset to snap-to nearest event worldDrag += snapOffset; DragOffsetWithSnap = worldDrag; GhostInfo[] ghosts = new GhostInfo[m_selection.Count]; IEnumerator <TimelinePath> events = m_selection.GetEnumerator(); m_worldGhostMin = float.MaxValue; m_worldGhostMax = float.MinValue; for (int i = 0; i < ghosts.Length; i++) { events.MoveNext(); IEvent curr = (IEvent)events.Current.Last; RectangleF bounds = layout[events.Current]; float viewStart = bounds.Left; float viewEnd = viewStart + bounds.Width; float worldStart = curr.Start; float worldEnd = worldStart + curr.Length; Resize( worldDrag, worldToView, ref viewStart, ref viewEnd, ref worldStart, ref worldEnd); float worldLength = worldEnd - worldStart; bounds = new RectangleF(viewStart, bounds.Y, viewEnd - viewStart, bounds.Height); if (m_worldGhostMin > worldStart) { m_worldGhostMin = worldStart; } if (m_worldGhostMax < worldEnd) { m_worldGhostMax = worldEnd; } bool valid = true; IInterval interval = curr as IInterval; if (interval != null) { TimelinePath testPath = new TimelinePath(events.Current); foreach (IInterval other in interval.Track.Intervals) { // Skip this interval if it's part of the selection because we have to assume // that the track began in a valid state and that all of the selected objects // will still be valid relative to each other. We only need to check that the // scaled objects are valid relative to the stationary objects. testPath.Last = other; if (Mode == ScaleMode.TimePeriod && m_selection.Contains(testPath)) { continue; } else if (other == interval) { continue; } if (!m_owner.Constraints.IsIntervalValid(interval, ref worldStart, ref worldLength, other)) { valid = false; break; } } } ghosts[i] = new GhostInfo(curr, null, worldStart, worldLength, bounds, valid); } m_ghosts = ghosts; return(ghosts); }