mirror of
https://github.com/BlackMATov/unity-iso-tools.git
synced 2026-01-04 17:20:57 +07:00
save for editor properties
This commit is contained in:
@@ -1,39 +1,37 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace IsoTools {
|
||||
namespace Examples {
|
||||
public class IsoController : MonoBehaviour {
|
||||
void MoveIsoObject(Vector3 dir) {
|
||||
var iso_object = GetComponent<IsoObject>();
|
||||
var iso_rigidbody = GetComponent<IsoRigidbody>();
|
||||
if ( iso_rigidbody ) {
|
||||
iso_rigidbody.Rigidbody.velocity = dir;
|
||||
}
|
||||
else if ( iso_object ) {
|
||||
iso_object.Position += dir * Time.deltaTime;
|
||||
}
|
||||
namespace IsoTools { namespace Examples {
|
||||
public class IsoController : MonoBehaviour {
|
||||
void MoveIsoObject(Vector3 dir) {
|
||||
var iso_object = GetComponent<IsoObject>();
|
||||
var iso_rigidbody = GetComponent<IsoRigidbody>();
|
||||
if ( iso_rigidbody ) {
|
||||
iso_rigidbody.Rigidbody.velocity = dir;
|
||||
}
|
||||
void Update () {
|
||||
if ( Input.GetKey(KeyCode.LeftArrow) ) {
|
||||
MoveIsoObject(new Vector3(-1, 0, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.RightArrow) ) {
|
||||
MoveIsoObject(new Vector3(1, 0, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.DownArrow) ) {
|
||||
MoveIsoObject(new Vector3(0, -1, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.UpArrow) ) {
|
||||
MoveIsoObject(new Vector3(0, 1, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.A) ) {
|
||||
MoveIsoObject(new Vector3(0, 0, 1));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.Z) ) {
|
||||
MoveIsoObject(new Vector3(0, 0, -1));
|
||||
}
|
||||
else if ( iso_object ) {
|
||||
iso_object.Position += dir * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
void Update () {
|
||||
if ( Input.GetKey(KeyCode.LeftArrow) ) {
|
||||
MoveIsoObject(new Vector3(-1, 0, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.RightArrow) ) {
|
||||
MoveIsoObject(new Vector3(1, 0, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.DownArrow) ) {
|
||||
MoveIsoObject(new Vector3(0, -1, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.UpArrow) ) {
|
||||
MoveIsoObject(new Vector3(0, 1, 0));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.A) ) {
|
||||
MoveIsoObject(new Vector3(0, 0, 1));
|
||||
}
|
||||
if ( Input.GetKey(KeyCode.Z) ) {
|
||||
MoveIsoObject(new Vector3(0, 0, -1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}} // namespace IsoTools::Examples
|
||||
Reference in New Issue
Block a user