m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
- m_DefaultBool: 1
- m_Controller: {fileID: 9100000}
+ m_DefaultBool: 0
+ m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
- m_Conditions:
- - m_ConditionMode: 1
- m_ConditionEvent: Attack
- m_EventTreshold: 0
+ m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -747310801136120961}
m_Solo: 0
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 718850486}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
- m_LocalPosition: {x: 847.6, y: -13.8, z: 0}
+ m_LocalPosition: {x: 853.6, y: -11.3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
public class BossMovement : StateMachineBehaviour
{
public float speed = 4.5f;
- public float attackRange = 1f;
+ public float attackRange = 3f;
Transform player;
Rigidbody2D rb;
BossDirection boss;
- BossTrigger bossTrigger;
// 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)
player = GameObject.FindGameObjectWithTag("Player").transform;
rb = animator.GetComponent<Rigidbody2D>();
boss = animator.GetComponent<BossDirection>();
- bossTrigger = animator.GetComponent<BossTrigger>();
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
public void OnTriggerEnter2D(Collider2D collision)
{
- bossFight = true;
- FindObjectOfType<AudioManager>().Stop("flowers");
- FindObjectOfType<AudioManager>().Play("snail_fight");
+ if(collision.gameObject.CompareTag("Player"))
+ {
+ bossFight = true;
+ FindObjectOfType<AudioManager>().Stop("flowers");
+ FindObjectOfType<AudioManager>().Play("snail_fight");
- boxCollider2D.enabled = false;
+ boxCollider2D.enabled = false;
+ }
}
}
[SerializeField]
int enemyHealth;
- // Start is called before the first frame update
- void Start()
- {
-
- }
-
// Update is called once per frame
void Update()
{