Skip to content

Instantly share code, notes, and snippets.

@s2kw
Created December 31, 2015 09:34
Show Gist options
  • Save s2kw/cea12003a9eb6016b128 to your computer and use it in GitHub Desktop.
Save s2kw/cea12003a9eb6016b128 to your computer and use it in GitHub Desktop.
Move pattern x 3
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//using UniRx; using UnityEngine.UI;
# if UNITY_EDITOR
using UnityEditor;
[CustomEditor( typeof( TestMove ) )]
public class TestMoveInspector : Editor{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
return;
var script = target as TestMove;
}
}
# endif
// namespace jigaX{
public class TestMove : MonoBehaviour {
CharacterController controller;
[SerializeField] float speed = 1f;
void Awake(){
this.controller = GetComponent<CharacterController>();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.controller.Move( Vector3.forward * this.speed );
}
}
// } // namespace
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//using UniRx; using UnityEngine.UI;
# if UNITY_EDITOR
using UnityEditor;
[CustomEditor( typeof( TestSimpleMove ) )]
public class TestSimpleMoveInspector : Editor{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
return;
var script = target as TestSimpleMove;
}
}
# endif
// namespace jigaX{
public class TestSimpleMove : MonoBehaviour {
CharacterController controller;
[SerializeField] float speed = 1f;
void Awake(){
this.controller = GetComponent<CharacterController>();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.controller.SimpleMove( Vector3.forward * this.speed );
}
}
// } // namespace
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//using UniRx; using UnityEngine.UI;
# if UNITY_EDITOR
using UnityEditor;
[CustomEditor( typeof( TestVelocity ) )]
public class NewBehaviourScriptInspector : Editor{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
return;
var script = target as TestVelocity;
}
}
# endif
// namespace jigaX{
public class TestVelocity : MonoBehaviour {
[SerializeField] float speed = 1f;
Rigidbody rigidbody;
void Awake(){
this.rigidbody = GetComponent<Rigidbody>();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.rigidbody.velocity = Vector3.forward * this.speed;
}
}
// } // namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment