46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
namespace G
|
|
{
|
|
public class Stat_JumpSkillAction : Stat_SkillAction
|
|
{
|
|
private float m_jumpMoveFactor = 0.7f;
|
|
private Vector3 m_jumpDir;
|
|
|
|
public bool m_onlyOne;
|
|
|
|
public Stat_JumpSkillAction(Stat_StateManager statMgr)
|
|
: base(statMgr)
|
|
{
|
|
}
|
|
|
|
public override bool Enter(Dictionary<string, object> param, bool clearDelegates = false)
|
|
{
|
|
bool flag = false;
|
|
m_jumpMoveFactor = 0.7f;
|
|
flag = base.Enter(param, clearDelegates);
|
|
m_jumpDir = m_char.transform.forward;
|
|
m_onlyOne = false;
|
|
if (param.ContainsKey("skill_touch_pos"))
|
|
{
|
|
m_touchPos = (Vector3)param["skill_touch_pos"];
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
protected override bool WarningEnd_CB(object[] param)
|
|
{
|
|
base.WarningEnd_CB(param);
|
|
float num = Vector3.Distance(m_char.transform.position, m_touchPos);
|
|
m_jumpDir = m_char.transform.forward;
|
|
m_jumpDir.y = 0f;
|
|
float d = 500f * num;
|
|
m_char.GetComponent<Rigidbody>().mass = 2f;
|
|
m_char.GetComponent<Rigidbody>().drag = 5f;
|
|
m_char.GetComponent<Rigidbody>().AddForce(m_jumpDir * d);
|
|
m_onlyOne = true;
|
|
return false;
|
|
}
|
|
}
|
|
}
|