Merge branch 'staging2' into combatscene
This commit is contained in:
@@ -20,7 +20,7 @@ AnimatorStateTransition:
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.85
|
||||
m_HasExitTime: 1
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
@@ -49,6 +49,7 @@ AnimatorState:
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -5558417074028381841}
|
||||
- {fileID: -1268510201227337377}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@@ -58,7 +59,7 @@ AnimatorState:
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: dbf4e442d523220489ca9531ab20161f, type: 3}
|
||||
m_Motion: {fileID: 7400000, guid: f5d4d1a7dadc5a84d910c492d947ca4f, type: 3}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
@@ -84,7 +85,32 @@ AnimatorStateTransition:
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.6875
|
||||
m_HasExitTime: 1
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &-5660328294272393165
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: EnemyInAttackRange
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: -6878085496064969341}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.70000005
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
@@ -109,7 +135,7 @@ AnimatorStateTransition:
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.625
|
||||
m_HasExitTime: 1
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
@@ -124,7 +150,8 @@ AnimatorState:
|
||||
m_Name: EnemyAttack
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions: []
|
||||
m_Transitions:
|
||||
- {fileID: -5660328294272393165}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@@ -140,6 +167,56 @@ AnimatorState:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &-1918993004881361147
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: EnemyInVisionRange
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 1102546605246812244}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.6875
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &-1268510201227337377
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 2
|
||||
m_ConditionEvent: EnemyInAggroRange
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 8194647877007136643}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 0.625
|
||||
m_HasExitTime: 0
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -400,28 +477,6 @@ AnimatorStateTransition:
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &1101549165158824158
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions: []
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 1102835054974116572}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 0
|
||||
serializedVersion: 3
|
||||
m_TransitionDuration: 0.25
|
||||
m_TransitionOffset: 0
|
||||
m_ExitTime: 4
|
||||
m_HasExitTime: 1
|
||||
m_HasFixedDuration: 1
|
||||
m_InterruptionSource: 0
|
||||
m_OrderedInterruption: 1
|
||||
m_CanTransitionToSelf: 1
|
||||
--- !u!1101 &1101571659118250030
|
||||
AnimatorStateTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -520,8 +575,7 @@ AnimatorState:
|
||||
m_Name: Dizzy
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: 1101549165158824158}
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@@ -979,74 +1033,74 @@ AnimatorStateMachine:
|
||||
m_ChildStates:
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102546605246812244}
|
||||
m_Position: {x: 340, y: 30, z: 0}
|
||||
m_Position: {x: 300, y: 140, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102428608990248820}
|
||||
m_Position: {x: 1400, y: 60, z: 0}
|
||||
m_Position: {x: 650, y: 120, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102941443349979230}
|
||||
m_Position: {x: 1400, y: 140, z: 0}
|
||||
m_Position: {x: 650, y: 200, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102311292720249994}
|
||||
m_Position: {x: 1400, y: 220, z: 0}
|
||||
m_Position: {x: 650, y: 280, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102508070621265122}
|
||||
m_Position: {x: 1650, y: -30, z: 0}
|
||||
m_Position: {x: 900, y: 30, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102615628393760256}
|
||||
m_Position: {x: 1650, y: 60, z: 0}
|
||||
m_Position: {x: 900, y: 120, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102840220384220776}
|
||||
m_Position: {x: 1650, y: 140, z: 0}
|
||||
m_Position: {x: 900, y: 200, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102224988525881432}
|
||||
m_Position: {x: 1650, y: 220, z: 0}
|
||||
m_Position: {x: 900, y: 280, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102906356952716468}
|
||||
m_Position: {x: 1650, y: 310, z: 0}
|
||||
m_Position: {x: 900, y: 370, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102275823511186668}
|
||||
m_Position: {x: 1910, y: -30, z: 0}
|
||||
m_Position: {x: 1160, y: 30, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102272222388203014}
|
||||
m_Position: {x: 1910, y: 60, z: 0}
|
||||
m_Position: {x: 1160, y: 120, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102080339498404604}
|
||||
m_Position: {x: 1910, y: 140, z: 0}
|
||||
m_Position: {x: 1160, y: 200, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102049015754028010}
|
||||
m_Position: {x: 1910, y: 220, z: 0}
|
||||
m_Position: {x: 1160, y: 280, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102486251471425260}
|
||||
m_Position: {x: 1910, y: 310, z: 0}
|
||||
m_Position: {x: 1160, y: 370, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102960180878307256}
|
||||
m_Position: {x: 1840, y: 390, z: 0}
|
||||
m_Position: {x: 670, y: 480, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102022585587399682}
|
||||
m_Position: {x: 1650, y: 480, z: 0}
|
||||
m_Position: {x: 670, y: 550, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 1102835054974116572}
|
||||
m_Position: {x: 1270, y: 370, z: 0}
|
||||
m_Position: {x: 280, y: 510, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: 8194647877007136643}
|
||||
m_Position: {x: 730, y: 20, z: 0}
|
||||
m_Position: {x: 300, y: 220, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -1989803667490188130}
|
||||
m_Position: {x: 760, y: 340, z: 0}
|
||||
m_Position: {x: 300, y: 380, z: 0}
|
||||
- serializedVersion: 1
|
||||
m_State: {fileID: -6878085496064969341}
|
||||
m_Position: {x: 910, y: 170, z: 0}
|
||||
m_Position: {x: 300, y: 300, z: 0}
|
||||
m_ChildStateMachines: []
|
||||
m_AnyStateTransitions: []
|
||||
m_EntryTransitions: []
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
m_ExitPosition: {x: 48, y: 228, z: 0}
|
||||
m_EntryPosition: {x: 100, y: 150, z: 0}
|
||||
m_ExitPosition: {x: 90, y: 510, z: 0}
|
||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||
m_DefaultState: {fileID: -1989803667490188130}
|
||||
m_DefaultState: {fileID: 1102546605246812244}
|
||||
--- !u!1102 &8194647877007136643
|
||||
AnimatorState:
|
||||
serializedVersion: 6
|
||||
@@ -1059,6 +1113,7 @@ AnimatorState:
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -5882858675207143937}
|
||||
- {fileID: -1918993004881361147}
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
|
||||
@@ -1,21 +1,84 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class SlimeAI : MonoBehaviour
|
||||
{
|
||||
|
||||
Animator animator;
|
||||
float playerDistance;
|
||||
GameObject player;
|
||||
int HP;
|
||||
|
||||
//[SerializeField]
|
||||
//private UnityEvent onAttack;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
player = GameObject.FindWithTag("Player");
|
||||
HP = 10;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
playerDistance = Vector3.Distance(player.transform.position, transform.position);
|
||||
if (playerDistance < 1.5) //Attack
|
||||
{
|
||||
animator.SetBool("EnemyInAttackRange", true);
|
||||
animator.SetBool("EnemyInAggroRange", true);
|
||||
animator.SetBool("EnemyInVisionRange", true);
|
||||
Rotate();
|
||||
}
|
||||
else if (playerDistance < 5) //Chase
|
||||
{
|
||||
animator.SetBool("EnemyInAttackRange", false);
|
||||
animator.SetBool("EnemyInAggroRange", true);
|
||||
animator.SetBool("EnemyInVisionRange", true);
|
||||
Rotate();
|
||||
Move();
|
||||
}
|
||||
else if (playerDistance < 8) //Stare
|
||||
{
|
||||
animator.SetBool("EnemyInAttackRange", false);
|
||||
animator.SetBool("EnemyInAggroRange", false);
|
||||
animator.SetBool("EnemyInVisionRange", true);
|
||||
Rotate();
|
||||
}
|
||||
else //Idle
|
||||
{
|
||||
animator.SetBool("EnemyInAttackRange", false);
|
||||
animator.SetBool("EnemyInAggroRange", false);
|
||||
animator.SetBool("EnemyInVisionRange", false);
|
||||
}
|
||||
if (HP <= 0)
|
||||
{
|
||||
animator.SetBool("Dead", true);
|
||||
}
|
||||
if (animator.GetBool("DeathComplete"))
|
||||
{
|
||||
print("asd");
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
void Rotate()
|
||||
{
|
||||
// Rotate the forward vector towards the target direction by one step
|
||||
Vector3 newDirection = Vector3.RotateTowards(transform.forward, player.transform.position - transform.position, 1.0f * Time.deltaTime, 0.0f);
|
||||
|
||||
// Calculate a rotation a step closer to the target and applies rotation to this object
|
||||
transform.rotation = Quaternion.LookRotation(newDirection);
|
||||
}
|
||||
void Move()
|
||||
{
|
||||
transform.position += transform.forward * Time.deltaTime * 1.0f;
|
||||
}
|
||||
|
||||
public void GetHit(int dmg)
|
||||
{
|
||||
HP -= dmg;
|
||||
}
|
||||
}
|
||||
|
||||
36
Assets/Project Files/Scripts/Arlo/SlimeDeath.cs
Normal file
36
Assets/Project Files/Scripts/Arlo/SlimeDeath.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class death : StateMachineBehaviour
|
||||
{
|
||||
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
|
||||
//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
|
||||
//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
|
||||
//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
// OnStateMove is called right after Animator.OnAnimatorMove()
|
||||
//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
// // Implement code that processes and affects root motion
|
||||
//}
|
||||
|
||||
// OnStateIK is called right after Animator.OnAnimatorIK()
|
||||
//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
//{
|
||||
// // Implement code that sets up animation IK (inverse kinematics)
|
||||
//}
|
||||
}
|
||||
11
Assets/Project Files/Scripts/Arlo/SlimeDeath.cs.meta
Normal file
11
Assets/Project Files/Scripts/Arlo/SlimeDeath.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c7f89faf36f41b418e5105a12c34cdb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user