Skip to content

Commit 9e7f493

Browse files
committed
Moving Platform pattern
1 parent 9921295 commit 9e7f493

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

Assets/Level 1.unity

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,24 @@ Prefab:
838838
m_RemovedComponents: []
839839
m_ParentPrefab: {fileID: 100100000, guid: f04f4cbf806141e43893a05054f7d7f3, type: 2}
840840
m_IsPrefabParent: 0
841+
--- !u!1 &586543199 stripped
842+
GameObject:
843+
m_PrefabParentObject: {fileID: 1526995160486580, guid: f04f4cbf806141e43893a05054f7d7f3,
844+
type: 2}
845+
m_PrefabInternal: {fileID: 443149028}
846+
--- !u!114 &586543203
847+
MonoBehaviour:
848+
m_ObjectHideFlags: 0
849+
m_PrefabParentObject: {fileID: 0}
850+
m_PrefabInternal: {fileID: 0}
851+
m_GameObject: {fileID: 586543199}
852+
m_Enabled: 1
853+
m_EditorHideFlags: 0
854+
m_Script: {fileID: 11500000, guid: 1dc38651a5888af41a1c1ca982894f34, type: 3}
855+
m_Name:
856+
m_EditorClassIdentifier:
857+
movementVector: {x: 20, y: 0, z: 0}
858+
movementFactor: 0
841859
--- !u!1001 &633963443
842860
Prefab:
843861
m_ObjectHideFlags: 0

Assets/Oscilator.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
[DisallowMultipleComponent]
6+
public class Oscilator : MonoBehaviour {
7+
[SerializeField] Vector3 movementVector;
8+
[Range(0, 1)] [SerializeField] float movementFactor;
9+
Vector3 startingPos;
10+
// Use this for initialization
11+
void Start ()
12+
{
13+
startingPos = transform.position;
14+
}
15+
16+
// Update is called once per frame
17+
void Update ()
18+
{
19+
Vector3 offset = movementVector * movementFactor;
20+
transform.position = offset + startingPos;
21+
22+
}
23+
}

Assets/Oscilator.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)