physics wip

This commit is contained in:
2015-07-05 20:05:18 +06:00
parent 569efe5e82
commit ba3448a39b
9 changed files with 48 additions and 23 deletions

View File

@@ -42,6 +42,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_size: {x: 1, y: 1, z: 1} _size: {x: 1, y: 1, z: 1}
_position: {x: 0, y: 0, z: 0} _position: {x: 0, y: 0, z: 0}
_alignment: 1
_showBounds: 0
--- !u!212 &21217528 --- !u!212 &21217528
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@@ -42,6 +42,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_size: {x: 1, y: 1, z: 3} _size: {x: 1, y: 1, z: 3}
_position: {x: 0, y: 0, z: 0} _position: {x: 0, y: 0, z: 0}
_alignment: 1
_showBounds: 0
--- !u!212 &21263702 --- !u!212 &21263702
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@@ -42,6 +42,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_size: {x: 1, y: 3, z: 1} _size: {x: 1, y: 3, z: 1}
_position: {x: 0, y: 0, z: 0} _position: {x: 0, y: 0, z: 0}
_alignment: 1
_showBounds: 0
--- !u!212 &21253620 --- !u!212 &21253620
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@@ -42,6 +42,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_size: {x: 3, y: 1, z: 1} _size: {x: 3, y: 1, z: 1}
_position: {x: 0, y: 0, z: 0} _position: {x: 0, y: 0, z: 0}
_alignment: 1
_showBounds: 0
--- !u!212 &21262204 --- !u!212 &21262204
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@@ -42,6 +42,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_size: {x: 3, y: 3, z: 0} _size: {x: 3, y: 3, z: 0}
_position: {x: 0, y: 0, z: 0} _position: {x: 0, y: 0, z: 0}
_alignment: 1
_showBounds: 0
--- !u!212 &21253404 --- !u!212 &21253404
SpriteRenderer: SpriteRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@@ -279,11 +279,11 @@ Prefab:
m_Modifications: m_Modifications:
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0 value: -3.59999847
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 48 value: 75.8300018
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@@ -307,19 +307,27 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 0 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.x propertyPath: _position.x
value: 1 value: .626875162
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.y propertyPath: _position.y
value: 1 value: .851875067
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} - target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _position.z propertyPath: _position.z
value: 2 value: 4
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _alignment
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11417528, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}
propertyPath: _showBounds
value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2} m_ParentPrefab: {fileID: 100100000, guid: c1b9b2ad3a021c549aa9190df3101248, type: 2}

View File

@@ -1,5 +1,4 @@
using UnityEngine; using UnityEngine;
using System.Collections.Generic;
namespace IsoTools { namespace IsoTools {
public class IsoFakeObject : MonoBehaviour { public class IsoFakeObject : MonoBehaviour {

View File

@@ -251,6 +251,16 @@ namespace IsoTools {
} }
#if UNITY_EDITOR #if UNITY_EDITOR
void Reset() {
Size = Vector3.one;
Position = Vector3.zero;
}
void OnValidate() {
Size = _size;
Position = _position;
}
void OnDrawGizmos() { void OnDrawGizmos() {
if ( ShowBounds && IsoWorld ) { if ( ShowBounds && IsoWorld ) {
IsoUtils.DrawCube(IsoWorld, Position + Size * 0.5f, Size, Color.red); IsoUtils.DrawCube(IsoWorld, Position + Size * 0.5f, Size, Color.red);

View File

@@ -39,10 +39,6 @@ namespace IsoTools {
} }
bool _dirty = true; bool _dirty = true;
float _lastTileSize = 0.0f;
float _lastMinDepth = 0.0f;
float _lastMaxDepth = 0.0f;
List<SectorInfo> _sectors = new List<SectorInfo>(); List<SectorInfo> _sectors = new List<SectorInfo>();
List<ObjectInfo> _objects = new List<ObjectInfo>(); List<ObjectInfo> _objects = new List<ObjectInfo>();
List<int> _depends = new List<int>(); List<int> _depends = new List<int>();
@@ -155,10 +151,6 @@ namespace IsoTools {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
bool IsIsoObjectVisible(IsoObject iso_object) { bool IsIsoObjectVisible(IsoObject iso_object) {
var renderer = iso_object.GetComponent<Renderer>();
if ( renderer && renderer.isVisible ) {
return true;
}
var renderers = iso_object.GetComponentsInChildren<Renderer>(); var renderers = iso_object.GetComponentsInChildren<Renderer>();
return renderers.Any(r => r.isVisible); return renderers.Any(r => r.isVisible);
} }
@@ -189,9 +181,6 @@ namespace IsoTools {
void ChangeSortingProperty() { void ChangeSortingProperty() {
MarkDirty(); MarkDirty();
FixAllTransforms(); FixAllTransforms();
_lastTileSize = TileSize;
_lastMinDepth = MinDepth;
_lastMaxDepth = MaxDepth;
} }
int SectorIndex(Vector3 num_pos) { int SectorIndex(Vector3 num_pos) {
@@ -386,11 +375,6 @@ namespace IsoTools {
} }
void LateUpdate() { void LateUpdate() {
if ( Application.isEditor ) {
if ( !Mathf.Approximately(_lastTileSize, _tileSize) ) TileSize = _tileSize;
if ( !Mathf.Approximately(_lastMinDepth, _minDepth) ) MinDepth = _minDepth;
if ( !Mathf.Approximately(_lastMaxDepth, _maxDepth) ) MaxDepth = _maxDepth;
}
StepSort(); StepSort();
} }
@@ -401,5 +385,19 @@ namespace IsoTools {
void OnDisable() { void OnDisable() {
ResetAllIsoWorld(); ResetAllIsoWorld();
} }
#if UNITY_EDITOR
void Reset() {
TileSize = 32.0f;
MinDepth = 0.0f;
MaxDepth = 100.0f;
}
void OnValidate() {
TileSize = _tileSize;
MinDepth = _minDepth;
MaxDepth = _maxDepth;
}
#endif
} }
} // namespace IsoTools } // namespace IsoTools