public void ShowLastRecordingStillframe() { RemoveLastRecordingStillframes(); if (lastRecording == null) { return; } foreach (var g in lastRecording.recordedObjects) { //Debug.Log(lastRecording.frames[g][0].GetPosition()); var projection = Instantiate(g, this.transform); projection.transform.localPosition = lastRecording.frames[g][0].GetPosition(); var p = projection.AddComponent <Projection>(); p.projectorCollider = recordingArea; var sprite = p.GetComponent <SpriteRenderer>(); sprite.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; sprite.color = new Color(1, 1, 1, 0.5f); p.gameObject.layer = LayerMask.NameToLayer("ProjectionInvisible"); p.gameObject.tag = "ProjectionInvisible"; WalkScript ws = p.GetComponent <WalkScript>(); if (ws) { ws.enabled = false; } } }
public void StartProjection(Recording r) { if (r == null) { //Debug.Log("Nothing to play back"); this.recording = null; return; } this.recording = r; foreach (var g in recording.recordedObjects) { var projection = Instantiate(g, this.transform); projection.transform.localPosition = recording.frames[g][0].GetPosition(); projection.transform.localRotation = g.transform.localRotation; var p = projection.AddComponent <Projection>(); p.direction = recording.direction; p.projectorCollider = recordingArea; var sprite = p.GetComponent <SpriteRenderer>(); sprite.maskInteraction = SpriteMaskInteraction.VisibleInsideMask; sprite.color = new Color(1, 1, 1, 0.5f); projections.Add(p); frameIterators.Add(p, recording.frames[g]); playbackFrame = 1; WalkScript ws = p.GetComponent <WalkScript>(); if (ws) { ws.enabled = false; } DartTrapAI trap = g.GetComponent <DartTrapAI>(); if (trap) { var t = p.GetComponent <DartTrapAI>(); t.SetCurrentOffset(recording.darttrapOffsets[trap]); darttrapOffsets.Add(t, recording.darttrapOffsets[trap]); } } }
void Start() { player = FindObjectOfType <WalkScript> (); if (textFile != null) { textLines = textFile.text.Split('\n'); } if (endAtLine == 0) { endAtLine = textLines.Length - 1; } if (isActive) { EnableTextBox(); } else { DisableTextBox(); } }
void Start() { walkSc = FindObjectOfType <WalkScript> (); //startText.text = startAsset.text; }
void Awake() { walkScript = this.gameObject.GetComponent <WalkScript>(); }