mycj_demo/mycj/Assets/Game/Scripts/Application/Object/FBCarrot.cs

91 lines
2.1 KiB
C#
Raw Normal View History

2024-12-02 09:37:47 +08:00
// Felix-BangFBCarrot
//   へ     /|
//  /7    ∠_/
//  / │    
//  Z _,    /`ヽ
// │     ヽ   /  〉
//  Y     `  /  /
// イ● 、 ●  ⊂⊃〈  /
// ()  へ    | \〈
//  >ー 、_  ィ  │
//  / へ   / ノ<|
//  ヽ_ノ  (_  │//
//  7       |
//  ―r ̄ ̄`ー―_
// Describe萝卜
// Createtime2018/10/15
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace FBApplication
{
public class FBCarrot : FBRole
{
#region
#endregion
#region
#endregion
#region
Animator f_animator;
#endregion
#region
#endregion
#region Unity回调
#endregion
#region
public override void OnSpawn()
{
base.OnSpawn();
f_animator = GetComponent<Animator>();
if (f_animator.gameObject.activeSelf)
f_animator.Play("Carrot_Idle");
FBCarrotInfo info = FBGame.Instance.StaticData.GetCarrot();
MaxHP = info.HP;
HP = info.HP;
}
public override void OnUnspawn()
{
base.OnUnspawn();
if (f_animator.gameObject.activeSelf)
{
f_animator.ResetTrigger("IsDamage");
f_animator.SetBool("IsDead", false);
}
}
#endregion
#region
public override void Damage(int hit)
{
if (IsDead) return;
base.Damage(hit);
if(f_animator.gameObject.activeSelf)
f_animator.SetTrigger("IsDamage");
}
protected override void OnDie(FBRole role)
{
base.OnDie(role);
if (f_animator.gameObject.activeSelf)
f_animator.SetBool("IsDead",true);
}
#endregion
#region
#endregion
}
}