- Improved the capture functionnality for Squad objects

-> see : http://http://unitydojo.blogspot.ca/2014/03/how-to-use-lerp-in-unity-like-boss.html
- Created ZombieSquad prefab
- Created VampireSquad prefab
This commit is contained in:
Samuel 2015-08-15 11:34:56 -04:00
parent 7342d75101
commit 702f323edc
15 changed files with 4656 additions and 69 deletions

1459
Assets/Prefabs/Human.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4cf1614d9b46f2848a2b47afe79f2f56
timeCreated: 1439652850
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,7 +16,7 @@ GameObject:
- 135: {fileID: 13577474}
- 114: {fileID: 11449880}
m_Layer: 0
m_Name: Vampire
m_Name: Old_Vampire
m_TagString: VampirePlayer
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -105,6 +105,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
defaultHp: 250
defaultAttack: 100
LerpSpeed: 1
destinationGap: 5
--- !u!135 &13577474
SphereCollider:
m_ObjectHideFlags: 1

View File

@ -16,7 +16,7 @@ GameObject:
- 135: {fileID: 13574734}
- 114: {fileID: 11458372}
m_Layer: 0
m_Name: Zombie
m_Name: Old_Zombie
m_TagString: ZombiePlayer
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -105,6 +105,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
defaultHp: 250
defaultAttack: 100
LerpSpeed: 1
destinationGap: 5
--- !u!135 &13574734
SphereCollider:
m_ObjectHideFlags: 1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eaa81b40663d4ca4e982795d1d9488e2
timeCreated: 1439652863
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 67442489137253e408a13ecfab4b5e3b
timeCreated: 1439652861
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -87,56 +87,6 @@ NavMeshSettings:
cellSize: .166666672
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &237808464 stripped
GameObject:
m_PrefabParentObject: {fileID: 100080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
m_PrefabInternal: {fileID: 749299731}
--- !u!136 &237808467
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 237808464}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 1.5
m_Height: 5
m_Direction: 1
m_Center: {x: 0, y: 2.54999995, z: 0}
--- !u!54 &237808468
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 237808464}
serializedVersion: 2
m_Mass: 1
m_Drag: Infinity
m_AngularDrag: Infinity
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 84
m_CollisionDetection: 0
--- !u!114 &237808469
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 237808464}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74f0a139db076b941b792c3ed8936539, type: 3}
m_Name:
m_EditorClassIdentifier:
AnimationSpeed: 1.5
LookSmoother: 3
ForwardSpeed: 7
BackwardSpeed: 2
RightSpeed: 7
LeftSpeed: 7
RotateSpeed: 2
--- !u!1 &614457924
GameObject:
m_ObjectHideFlags: 0
@ -196,8 +146,204 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 5
--- !u!1001 &623359541
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalPosition.x
value: 15
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalPosition.z
value: 25
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 404258, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 67442489137253e408a13ecfab4b5e3b, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &749299731
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalPosition.x
value: 7.81066799
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalPosition.z
value: 3.83980489
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 451766, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: eaa81b40663d4ca4e982795d1d9488e2, type: 2}
m_IsPrefabParent: 0
--- !u!1 &1387708718 stripped
GameObject:
m_PrefabParentObject: {fileID: 100080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
m_PrefabInternal: {fileID: 1562834474}
--- !u!114 &1387708720
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1387708718}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8a1ccd1ad32d6bc4fb600c5b5720e01c, type: 3}
m_Name:
m_EditorClassIdentifier:
defaultHp: 250
defaultAttack: 100
LerpSpeed: 1
destinationGap: 5
--- !u!114 &1387708721
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1387708718}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 74f0a139db076b941b792c3ed8936539, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!136 &1387708722
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1387708718}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 1.5
m_Height: 5
m_Direction: 1
m_Center: {x: 0, y: 2.54999995, z: 0}
--- !u!54 &1387708723
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1387708718}
serializedVersion: 2
m_Mass: 1
m_Drag: Infinity
m_AngularDrag: Infinity
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 84
m_CollisionDetection: 0
--- !u!135 &1387708725
SphereCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1387708718}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Radius: 5
m_Center: {x: 0, y: 5, z: 0}
--- !u!1001 &1535046822
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalPosition.x
value: 24.7399998
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalPosition.z
value: 3.83980489
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 447166, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 4cf1614d9b46f2848a2b47afe79f2f56, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &1562834474
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
@ -214,7 +360,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
propertyPath: m_LocalPosition.z
value: 3.83980489
value: 16.9099998
objectReference: {fileID: 0}
- target: {fileID: 400080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
propertyPath: m_LocalRotation.x
@ -234,7 +380,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 400080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
propertyPath: m_RootOrder
value: 0
value: 2
objectReference: {fileID: 0}
- target: {fileID: 9500000, guid: 927610a088e26e54893541b8be6c050c, type: 3}
propertyPath: m_Controller
@ -244,6 +390,10 @@ Prefab:
propertyPath: m_ApplyRootMotion
value: 1
objectReference: {fileID: 0}
- target: {fileID: 100080, guid: 927610a088e26e54893541b8be6c050c, type: 3}
propertyPath: m_Name
value: Human2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 927610a088e26e54893541b8be6c050c, type: 3}
m_IsPrefabParent: 0
@ -316,7 +466,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 6
--- !u!1 &2021066802
GameObject:
m_ObjectHideFlags: 0
@ -401,4 +551,4 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_RootOrder: 4

View File

@ -90,7 +90,7 @@ public class CharacterBehavior : MonoBehaviour
void FixedUpdate()
{
PlayRunAnimation(true);
//PlayRunAnimation(true);
//PlayRunAnimation(false);
//PlayAttackAnimation(true);
//PlayAttackAnimation(false);

View File

@ -224,9 +224,10 @@ public class Squad : Unit
// make the human a child of the squad game object
//Debug.Log(String.Format("Human parent before colision :{0}", unit.transform.name));
unit.IsCaptured = true;
unit.transform.parent = this.transform;
unit.transform.gameObject.GetComponent<Rigidbody>().useGravity = false;
unit.transform.localPosition = new Vector3(0, 0, 0);
//unit.transform.parent = this.transform;
unit.TargetDestination = this.transform;
//unit.transform.gameObject.GetComponent<Rigidbody>().useGravity = false;
//unit.transform.localPosition = new Vector3(0, 0, 0);
//Debug.Log(String.Format("Human parent before colision :{0}", unit.transform.parent.name));
AddHuman(unit);
Debug.Log(string.Format("{0} joined the squad of : {1} ", unit.gameObject.name, transform.gameObject.name));

View File

@ -9,7 +9,10 @@ public class Unit : MonoBehaviour
private LinkedList<Command> commandList;
public int defaultHp = 250;
public int defaultAttack = 100;
public float LerpSpeed = 1;
public int destinationGap = 5;
private int _hp; // the unit hp
private CharacterBehavior _character;
// Use this for initialization
void Start ()
{
@ -20,6 +23,23 @@ public class Unit : MonoBehaviour
Tag = TagLayerManager.Human;
Layer = TagLayerManager.HumanLayerIndex;
IsDead = false;
_character = GetComponent<CharacterBehavior>();
}
void Update()
{
if (IsCaptured)
{
var gapVector = new Vector3(TargetDestination.position.x + destinationGap, TargetDestination.position.y,TargetDestination.position.z + destinationGap);
// TODO improve the translation position so that every unit captured are around the squad leader and not at only one position.
transform.position = Vector3.Lerp(transform.position, gapVector, LerpSpeed * 3.0f * Time.deltaTime);
//See more at: http://unitydojo.blogspot.ca/2014/03/how-to-use-lerp-in-unity-like-boss.html#sthash.ueWlstRk.dpuf*/
_character.PlayCaptureAnimation(IsCaptured);
}
else
{
_character.PlayCaptureAnimation(IsCaptured);
}
}
/// <summary>
@ -73,6 +93,8 @@ public class Unit : MonoBehaviour
public int Attack { get; set; }
public bool IsDead { get; set; }
public Transform TargetDestination { get; set; }
public string Tag
{
get { return this.gameObject.tag; }

View File

@ -3,19 +3,17 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
serializedVersion: 7
AndroidProfiler: 0
defaultScreenOrientation: 4
targetDevice: 2
targetGlesGraphics: -1
targetIOSGraphics: -1
targetResolution: 0
accelerometerFrequency: 60
companyName: DefaultCompany
productName: VZ
cloudProjectId:
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_ShowUnitySplashScreen: 1
defaultScreenWidth: 1024
defaultScreenHeight: 768
defaultScreenWidthWeb: 960
@ -25,7 +23,6 @@ PlayerSettings:
m_ActiveColorSpace: 0
m_MTRendering: 1
m_MobileMTRendering: 0
m_UseDX11: 1
m_Stereoscopic3D: 0
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
@ -118,9 +115,11 @@ PlayerSettings:
serializedVersion: 2
rgba: 0
iOSLaunchScreenFillPct: 1
iOSLaunchScreenSize: 100
iOSLaunchScreenCustomXibPath:
AndroidTargetDevice: 0
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidTVCompatibility: 1
@ -130,6 +129,7 @@ PlayerSettings:
- width: 320
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
resolutionDialogBanner: {fileID: 0}
m_BuildTargetIcons:
- m_BuildTarget:
@ -137,6 +137,7 @@ PlayerSettings:
- m_Icon: {fileID: 0}
m_Size: 128
m_BuildTargetBatching: []
m_BuildTargetGraphicsAPIs: []
webPlayerTemplate: APPLICATION:Default
m_TemplateCustomTags: {}
actionOnDotNetUnhandledException: 1
@ -198,6 +199,7 @@ PlayerSettings:
ps4ApplicationParam2: 0
ps4ApplicationParam3: 0
ps4ApplicationParam4: 0
ps4GarlicHeapSize: 2048
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
@ -209,6 +211,7 @@ PlayerSettings:
psp2NPTrophyPackPath:
psp2NPSupportGBMorGJP: 0
psp2NPAgeRating: 12
psp2NPTitleDatPath:
psp2NPCommsID:
psp2NPCommunicationsID:
psp2NPCommsPassphrase:
@ -223,6 +226,7 @@ PlayerSettings:
psp2PatchOriginalPackage:
psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui
psp2KeystoneFile:
psp2MemoryExpansionMode: 0
psp2DRMType: 0
psp2StorageType: 0
psp2MediaCapacity: 0
@ -339,8 +343,7 @@ PlayerSettings:
blackberrySquareSplashScreen: {fileID: 0}
tizenProductDescription:
tizenProductURL:
tizenCertificatePath:
tizenCertificatePassword:
tizenSigningProfileName:
tizenGPSPermissions: 0
tizenMicrophonePermissions: 0
stvDeviceAddress:
@ -359,6 +362,7 @@ PlayerSettings:
XboxOnePackagingOverridePath:
XboxOneAppManifestOverridePath:
XboxOnePackageEncryption: 0
XboxOnePackageUpdateGranularity: 2
XboxOneDescription:
XboxOneIsContentPackage: 0
XboxOneEnableGPUVariability: 0
@ -401,4 +405,9 @@ PlayerSettings:
WebGL::emscriptenArgs:
WebGL::template: APPLICATION:Default
additionalIl2CppArgs::additionalIl2CppArgs:
firstStreamedLevelWithResources: 0
firstStreamedSceneWithResources: 0
cloudProjectId:
projectId:
projectName:
organizationId:
cloudEnabled: 0