Skip to content
Extraits de code Groupes Projets
Valider 0266b162 rédigé par Plou's avatar Plou
Parcourir les fichiers

Merge branch 'master' of https://git.iiens.net/poulet2018/alfa

parents 5d04b273 d7136e71
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AnimalTexture
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.8679245, g: 0.47972348, b: 0.06959773, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: 81fa57c50d32db348b7268d4c7297e58
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,8 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: GreenDef
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
......@@ -25,7 +25,7 @@ Material:
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Scale: {x: 0, y: 0}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
......@@ -37,11 +37,11 @@ Material:
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 4, y: 4}
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 10309, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 4, y: 4}
m_Scale: {x: 10, y: 10}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6167035808340811416
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6167035808340811420}
- component: {fileID: 6167035808340811423}
- component: {fileID: 6167035808340811422}
- component: {fileID: 6167035808340811417}
- component: {fileID: 6167035808340811421}
- component: {fileID: 6167035808340811410}
m_Layer: 0
m_Name: Animal
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6167035808340811420
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.152, y: 0.038, z: -0.32383025}
m_LocalScale: {x: 0.1, y: 0.2, z: 0.2}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6167035808340811423
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &6167035808340811422
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 81fa57c50d32db348b7268d4c7297e58, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &6167035808340811417
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &6167035808340811421
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81148b8144718ee4899ecbbce4f98d9f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_spawnPoint: {fileID: 0}
m_squareRadius: 1.5
m_sqrAttackDistance: 2
--- !u!195 &6167035808340811410
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6167035808340811416}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 0.7
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 500
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 1
m_BaseOffset: 0.5
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
fileFormatVersion: 2
guid: 6f78176393413754dba2fbad87479e7c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6544835915340077380
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6544835915340077387}
- component: {fileID: 6544835915340077386}
- component: {fileID: 6544835915340077381}
- component: {fileID: 6544835915340077384}
m_Layer: 0
m_Name: AnimalSpawner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6544835915340077387
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544835915340077380}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.142, y: 0.119, z: -0.944}
m_LocalScale: {x: 0.4, y: 0.3, z: 0.4}
m_Children:
- {fileID: 6544835915564464948}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6544835915340077386
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544835915340077380}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &6544835915340077381
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544835915340077380}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 81fa57c50d32db348b7268d4c7297e58, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!208 &6544835915340077384
NavMeshObstacle:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6544835915340077380}
m_Enabled: 1
serializedVersion: 3
m_Shape: 1
m_Extents: {x: 0.5, y: 0.5, z: 0.5}
m_MoveThreshold: 0.1
m_Carve: 1
m_CarveOnlyStationary: 1
m_Center: {x: 0, y: 0, z: 0}
m_TimeToStationary: 0.5
--- !u!1001 &1100668255576827304
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 6544835915340077387}
m_Modifications:
- target: {fileID: 6167035808340811416, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_Name
value: Animal
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalPosition.x
value: 0.014999993
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalPosition.y
value: -0.22666666
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.59957564
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalScale.x
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalScale.y
value: 0.6666666
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_LocalScale.z
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6167035808340811421, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
propertyPath: m_spawnPoint
value:
objectReference: {fileID: 6544835915340077380}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6f78176393413754dba2fbad87479e7c, type: 3}
--- !u!4 &6544835915564464948 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 6167035808340811420, guid: 6f78176393413754dba2fbad87479e7c,
type: 3}
m_PrefabInstance: {fileID: 1100668255576827304}
m_PrefabAsset: {fileID: 0}
fileFormatVersion: 2
guid: 7e7f36fae45bdc84a90768e5469566ab
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -17,7 +17,7 @@ GameObject:
- component: {fileID: 1003655326493528498}
m_Layer: 0
m_Name: Human
m_TagString: Untagged
m_TagString: Human
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......
Ce diff est replié.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Animal : MonoBehaviour
{
[SerializeField] protected GameObject m_spawnPoint;
[SerializeField] protected float m_squareRadius;
[SerializeField] protected float m_sqrAttackDistance;
protected bool m_modeWander = true;
protected bool m_modeFight = false;
protected bool m_modeFlee = false;
protected int m_frameCounter = 0;
protected GameObject target = null;
public GameObject FindClosestHuman()
{
GameObject[] gos;
gos = GameObject.FindGameObjectsWithTag("Human");
GameObject closest = null;
float distance = Mathf.Infinity;
Vector3 position = transform.position;
foreach (GameObject go in gos)
{
Vector3 diff = go.transform.position - position;
float curDistance = diff.sqrMagnitude;
if (curDistance < distance)
{
closest = go;
distance = curDistance;
}
}
return closest;
}
void Start()
{
NavMeshAgent agent = GetComponent<NavMeshAgent>();
agent.destination = new Vector3(Random.Range(m_spawnPoint.transform.position.x-m_squareRadius,m_spawnPoint.transform.position.x+m_squareRadius),m_spawnPoint.transform.position.y,Random.Range(m_spawnPoint.transform.position.z-m_squareRadius,m_spawnPoint.transform.position.z+m_squareRadius));
}
// Update is called once per frame
void FixedUpdate()
{
NavMeshAgent agent = GetComponent<NavMeshAgent>();
if(m_modeWander && (transform.position-agent.destination).sqrMagnitude<0.3f)
{
agent.destination = new Vector3(Random.Range(m_spawnPoint.transform.position.x-m_squareRadius,m_spawnPoint.transform.position.x+m_squareRadius),m_spawnPoint.transform.position.y,Random.Range(m_spawnPoint.transform.position.z-m_squareRadius,m_spawnPoint.transform.position.z+m_squareRadius));
}
if(m_modeFight)
{
agent.destination = target.transform.position;
if((transform.position-agent.destination).sqrMagnitude<0.2f)
{
Destroy(target);
target = null;
agent.destination = new Vector3(Random.Range(m_spawnPoint.transform.position.x-m_squareRadius,m_spawnPoint.transform.position.x+m_squareRadius),m_spawnPoint.transform.position.y,Random.Range(m_spawnPoint.transform.position.z-m_squareRadius,m_spawnPoint.transform.position.z+m_squareRadius));
m_modeWander = true;
m_modeFight = false;
agent.speed = 0.7f;
}
else if ((transform.position-m_spawnPoint.transform.position).sqrMagnitude > 2*m_squareRadius*m_squareRadius)
{
agent.destination = new Vector3(Random.Range(m_spawnPoint.transform.position.x-m_squareRadius,m_spawnPoint.transform.position.x+m_squareRadius),m_spawnPoint.transform.position.y,Random.Range(m_spawnPoint.transform.position.z-m_squareRadius,m_spawnPoint.transform.position.z+m_squareRadius));
m_modeWander = true;
m_modeFight = false;
agent.speed = 0.7f;
}
}
if(m_frameCounter == 7)
{
m_frameCounter = 0;
if((transform.position-m_spawnPoint.transform.position).sqrMagnitude < 1.2*m_squareRadius*m_squareRadius)
{
GameObject closest = FindClosestHuman();
if((transform.position-closest.transform.position).sqrMagnitude < m_sqrAttackDistance)
{
target = closest;
m_modeWander = false;
m_modeFight = true;
agent.speed = 2;
}
}
}
m_frameCounter += 1;
}
}
fileFormatVersion: 2
guid: 81148b8144718ee4899ecbbce4f98d9f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -18,6 +18,7 @@ public class HumanSpawner : MonoBehaviour
void Start()
{
stamp = Time.fixedTime;
Instantiate(m_human, transform.position, Quaternion.identity).SetActive(true);
delta = m_originalDelta;
}
......@@ -27,7 +28,7 @@ public class HumanSpawner : MonoBehaviour
if(Time.fixedTime - stamp > delta)
{
stamp = Time.fixedTime;
Instantiate(m_human, transform.position, Quaternion.identity);
Instantiate(m_human, transform.position, Quaternion.identity).SetActive(true);
if(delta > m_floor )delta -= 1;
}
}
......
......@@ -16,6 +16,7 @@ TagManager:
- ThunderSpawner
- Eclair
- GameManager
- Human
layers:
- Default
- TransparentFX
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter