78 lines
1.8 KiB
C#
78 lines
1.8 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2020-09-02
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "Stat_IdleAction" company="Kimch"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace G
|
|
{
|
|
|
|
public class Stat_CharmAction : Stat_BaseAction
|
|
{
|
|
private Transform m_target;
|
|
|
|
private Vector3 m_curDir;
|
|
|
|
private float m_moveSpeed;
|
|
|
|
public Stat_CharmAction(Stat_StateManager statMgr)
|
|
: base(statMgr)
|
|
{
|
|
}
|
|
|
|
public override bool Enter(Dictionary<string, object> param, bool clearDelegates = false)
|
|
{
|
|
base.Enter(param, clearDelegates);
|
|
if (param == null || param.Count <= 0 || !param.ContainsKey("charm_target"))
|
|
{
|
|
Debug.LogError("param is error");
|
|
return false;
|
|
}
|
|
m_target = (Transform)param["charm_target"];
|
|
m_curDir = m_target.position - m_char.position;
|
|
m_curDir = m_curDir.normalized;
|
|
m_moveSpeed = m_char.GetMoveSpeed();
|
|
return true;
|
|
}
|
|
|
|
public override bool UpdateDelegate()
|
|
{
|
|
float num = Vector3.Distance(m_target.position, m_char.position);
|
|
if (num < 0.1f)
|
|
{
|
|
return true;
|
|
}
|
|
//if (!m_char.m_animation.IsPlaying("walk"))
|
|
//{
|
|
// m_char.m_animation.CrossFade("walk");
|
|
//}
|
|
m_curDir = m_target.position - m_char.position;
|
|
Vector3.Normalize(m_curDir);
|
|
m_curDir.y = 0f;
|
|
m_char.Move(m_curDir, m_moveSpeed);
|
|
return true;
|
|
}
|
|
|
|
public override bool CanTransition(enStat stat)
|
|
{
|
|
bool result = false;
|
|
if (stat == enStat.STAT_ACTION_DEAD)
|
|
{
|
|
result = true;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private void SetTimers()
|
|
{
|
|
}
|
|
}
|
|
}
|