mirror of
https://github.com/ConjureETS/VZ.git
synced 2026-03-24 02:11:15 +00:00
- Updated Unity Layers
- Refactoring rename Class TagManager to TagLayerManager - Added Layer Property in class Unit.cs - Updated method InitializeDefaultTagAndLayer in class ZombieSquad and VampireSquad - Layers now are instancied at run time if the user ommit to specify a layer by default the human layer is set to any gameObject that have an Unit.cs script attached to it's component. Idem for ZombieSquad and VampireSquad
This commit is contained in:
parent
a4320a4b80
commit
c12f4497fd
@ -138,6 +138,10 @@ Prefab:
|
|||||||
propertyPath: m_Materials.Array.data[0]
|
propertyPath: m_Materials.Array.data[0]
|
||||||
value:
|
value:
|
||||||
objectReference: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
objectReference: {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
|
- target: {fileID: 5460952, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_IsKinematic
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents:
|
m_RemovedComponents:
|
||||||
- {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
- {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
@ -298,7 +302,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 3
|
||||||
--- !u!1 &550371263
|
--- !u!1 &550371263
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -358,7 +362,57 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 4
|
||||||
|
--- !u!1001 &1070827265
|
||||||
|
Prefab:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 7.80999994
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 5
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 421072, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_RootOrder
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 11449880, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: defaultHp
|
||||||
|
value: 10050
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Vampire (1)
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_ParentPrefab: {fileID: 100100000, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
|
m_IsPrefabParent: 0
|
||||||
--- !u!1 &1191318663 stripped
|
--- !u!1 &1191318663 stripped
|
||||||
GameObject:
|
GameObject:
|
||||||
m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
m_PrefabParentObject: {fileID: 159974, guid: 55aad163f90cc4e40b686a69ba29569d, type: 2}
|
||||||
@ -533,7 +587,7 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 5
|
||||||
--- !u!1 &1740025638
|
--- !u!1 &1740025638
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -606,4 +660,4 @@ Transform:
|
|||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_RootOrder: 7
|
m_RootOrder: 8
|
||||||
|
|||||||
@ -184,7 +184,7 @@ public class Squad : Unit
|
|||||||
humanUnit.Tag = Tag;
|
humanUnit.Tag = Tag;
|
||||||
|
|
||||||
// AddSoldier((VampireSquad) humanUnit) ) (VampireSquad or ZombieSquad)
|
// AddSoldier((VampireSquad) humanUnit) ) (VampireSquad or ZombieSquad)
|
||||||
if (Tag.Equals(TagManager.VampirePlayer))
|
if (Tag.Equals(TagLayerManager.VampirePlayer))
|
||||||
{
|
{
|
||||||
// add the vampire to the soldier list
|
// add the vampire to the soldier list
|
||||||
AddSoldier((VampireSquad) humanUnit);
|
AddSoldier((VampireSquad) humanUnit);
|
||||||
@ -232,7 +232,7 @@ public class Squad : Unit
|
|||||||
//unit.Hp -= Attack; // we remove some hp of the unit that was
|
//unit.Hp -= Attack; // we remove some hp of the unit that was
|
||||||
targettedEnemySquad.ReceiveDamage(ComputeAttackDamage());
|
targettedEnemySquad.ReceiveDamage(ComputeAttackDamage());
|
||||||
|
|
||||||
Debug.Log("Attacked the ennemy : " + targettedEnemySquad.Tag);
|
Debug.Log("Attacked the enemy : " + targettedEnemySquad.Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
19
Assets/Scripts/TagLayerManager.cs
Normal file
19
Assets/Scripts/TagLayerManager.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
public class TagLayerManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
// Use this for initialization
|
||||||
|
private static readonly string[] availableTags = UnityEditorInternal.InternalEditorUtility.tags;
|
||||||
|
private static readonly string[] availableLayers = UnityEditorInternal.InternalEditorUtility.layers;
|
||||||
|
// TODO FIND A WAY TO ADD EXCEPTION ERROR IF THE USER OMMIT TO ADD TAGS!!!
|
||||||
|
public static string Human = availableTags[7];
|
||||||
|
public static string VampirePlayer = availableTags[8];
|
||||||
|
public static string ZombiePlayer = availableTags[9];
|
||||||
|
// TODO remove hard coding layers
|
||||||
|
public static int HumanLayerIndex = 8;
|
||||||
|
public static int VampireLayerIndex = 9;
|
||||||
|
public static int ZombieLayerIndex = 10;
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
public class TagManager : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Use this for initialization
|
|
||||||
private static readonly String[] availableTags = UnityEditorInternal.InternalEditorUtility.tags;
|
|
||||||
// TODO FIND A WAY TO ADD EXCEPTION ERROR IF THE USER OMMIT TO ADD TAGS!!!
|
|
||||||
public static String Human = availableTags[7];
|
|
||||||
public static String VampirePlayer = availableTags[8];
|
|
||||||
public static String ZombiePlayer = availableTags[9];
|
|
||||||
}
|
|
||||||
@ -14,12 +14,11 @@ public class Unit : MonoBehaviour
|
|||||||
void Start ()
|
void Start ()
|
||||||
{
|
{
|
||||||
IsCaptured = false;
|
IsCaptured = false;
|
||||||
// initialize default hp
|
|
||||||
Hp = defaultHp;
|
Hp = defaultHp;
|
||||||
// initialize default attack
|
|
||||||
Attack = defaultAttack;
|
Attack = defaultAttack;
|
||||||
// initialize default team
|
|
||||||
// initialize default specie
|
// initialize default specie
|
||||||
|
Tag = TagLayerManager.Human;
|
||||||
|
Layer = TagLayerManager.HumanLayerIndex;
|
||||||
IsDead = false;
|
IsDead = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,16 +71,20 @@ public class Unit : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int Attack { get; set; }
|
public int Attack { get; set; }
|
||||||
//public bool isAlly { get; set; }
|
|
||||||
//public bool isHuman { get; set; }
|
|
||||||
public bool IsDead { get; set; }
|
public bool IsDead { get; set; }
|
||||||
|
|
||||||
public String Tag
|
public string Tag
|
||||||
{
|
{
|
||||||
get { return this.gameObject.tag; }
|
get { return this.gameObject.tag; }
|
||||||
set { gameObject.tag = value; }
|
set { gameObject.tag = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Layer
|
||||||
|
{
|
||||||
|
get { return this.gameObject.layer; }
|
||||||
|
set { gameObject.layer = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public class VampireSquad : Squad
|
|||||||
void Start ()
|
void Start ()
|
||||||
{
|
{
|
||||||
InitializeSquad();
|
InitializeSquad();
|
||||||
InitializeDefaultTag();
|
InitializeDefaultTagAndLayer();
|
||||||
// initialize default hp
|
// initialize default hp
|
||||||
//Hp = defaultHp;
|
//Hp = defaultHp;
|
||||||
// initialize default attack
|
// initialize default attack
|
||||||
@ -31,22 +31,27 @@ public class VampireSquad : Squad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeDefaultTag()
|
private void InitializeDefaultTagAndLayer()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.Tag = TagManager.VampirePlayer; // set the tag to player 1
|
this.Tag = TagLayerManager.VampirePlayer; // set the tag to player 1
|
||||||
|
this.Layer = TagLayerManager.VampireLayerIndex;
|
||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException ex)
|
catch (IndexOutOfRangeException ex)
|
||||||
{
|
{
|
||||||
Debug.LogError( "Please set a vampire Tag, check the Tag & layers in the inspector!\n" + ex );
|
Debug.LogError( "Please set a vampire Tag, check the Tag & layers in the inspector!\n" + ex );
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the tag of the gameObject to vampire
|
// set the tag and the layer of the gameObject to vampire
|
||||||
if (this.gameObject.tag != Tag)
|
if (this.gameObject.tag != Tag)
|
||||||
{
|
{
|
||||||
this.gameObject.tag = Tag;
|
this.gameObject.tag = Tag;
|
||||||
}
|
}
|
||||||
|
if (this.gameObject.layer != Layer)
|
||||||
|
{
|
||||||
|
this.gameObject.layer = Layer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void CaptureHuman(Unit unit)
|
/*void CaptureHuman(Unit unit)
|
||||||
@ -78,7 +83,7 @@ public class VampireSquad : Squad
|
|||||||
if (this.Tag == unitComponent.Tag)
|
if (this.Tag == unitComponent.Tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (unitComponent.Tag.Equals(TagManager.Human))
|
if (unitComponent.Tag.Equals(TagLayerManager.Human))
|
||||||
{
|
{
|
||||||
if (unitComponent.IsCaptured)
|
if (unitComponent.IsCaptured)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ public class ZombieSquad : Squad
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
InitializeSquad();
|
InitializeSquad();
|
||||||
InitializeDefaultTag();
|
InitializeDefaultTagAndLayer();
|
||||||
// initialize default hp
|
// initialize default hp
|
||||||
//Hp = defaultHp;
|
//Hp = defaultHp;
|
||||||
// initialize default attack
|
// initialize default attack
|
||||||
@ -31,22 +31,27 @@ public class ZombieSquad : Squad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeDefaultTag()
|
private void InitializeDefaultTagAndLayer()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.Tag = TagManager.ZombiePlayer; // set the tag to player 1
|
this.Tag = TagLayerManager.ZombiePlayer; // set the tag to player 1
|
||||||
|
this.Layer = TagLayerManager.ZombieLayerIndex;
|
||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException ex)
|
catch (IndexOutOfRangeException ex)
|
||||||
{
|
{
|
||||||
Debug.LogError("Please set a vampire Tag, check the Tag & layers in the inspector!\n" + ex);
|
Debug.LogError("Please set a vampire Tag, check the Tag & layers in the inspector!\n" + ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the tag of the gameObject to zombie
|
// set the tag and the layer of the gameObject to vampire
|
||||||
if (this.gameObject.tag != Tag)
|
if (this.gameObject.tag != Tag)
|
||||||
{
|
{
|
||||||
this.gameObject.tag = Tag;
|
this.gameObject.tag = Tag;
|
||||||
}
|
}
|
||||||
|
if (this.gameObject.layer != Layer)
|
||||||
|
{
|
||||||
|
this.gameObject.layer = Layer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void CaptureHuman(Unit unit)
|
/*void CaptureHuman(Unit unit)
|
||||||
@ -77,7 +82,7 @@ public class ZombieSquad : Squad
|
|||||||
if (this.Tag == unitComponent.Tag)
|
if (this.Tag == unitComponent.Tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (unitComponent.Tag.Equals(TagManager.Human))
|
if (unitComponent.Tag.Equals(TagLayerManager.Human))
|
||||||
{
|
{
|
||||||
CaptureHuman(unitComponent);
|
CaptureHuman(unitComponent);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,4 +11,4 @@ PhysicsManager:
|
|||||||
m_SolverIterationCount: 6
|
m_SolverIterationCount: 6
|
||||||
m_RaycastsHitTriggers: 1
|
m_RaycastsHitTriggers: 1
|
||||||
m_EnableAdaptiveForce: 0
|
m_EnableAdaptiveForce: 0
|
||||||
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffffdfffffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
m_EditorVersion: 5.0.0f4
|
m_EditorVersion: 5.1.0f3
|
||||||
m_StandardAssetsVersion: 0
|
m_StandardAssetsVersion: 0
|
||||||
|
|||||||
@ -144,21 +144,4 @@ QualitySettings:
|
|||||||
maximumLODLevel: 0
|
maximumLODLevel: 0
|
||||||
particleRaycastBudget: 4096
|
particleRaycastBudget: 4096
|
||||||
excludedTargetPlatforms: []
|
excludedTargetPlatforms: []
|
||||||
m_PerPlatformDefaultQuality:
|
m_PerPlatformDefaultQuality: {}
|
||||||
Android: 2
|
|
||||||
BlackBerry: 2
|
|
||||||
GLES Emulation: 5
|
|
||||||
PS3: 5
|
|
||||||
PS4: 5
|
|
||||||
PSM: 5
|
|
||||||
PSP2: 5
|
|
||||||
Samsung TV: 2
|
|
||||||
Standalone: 5
|
|
||||||
Tizen: 2
|
|
||||||
WP8: 5
|
|
||||||
Web: 5
|
|
||||||
WebGL: 3
|
|
||||||
Windows Store Apps: 5
|
|
||||||
XBOX360: 5
|
|
||||||
XboxOne: 5
|
|
||||||
iPhone: 2
|
|
||||||
|
|||||||
@ -16,9 +16,9 @@ TagManager:
|
|||||||
- UI
|
- UI
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
- Human
|
||||||
-
|
- VampirePlayer
|
||||||
-
|
- ZombiePlayer
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
-
|
-
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user