// 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) { if (AnimatorMgr.onStateEnter != null) { AnimatorMgr.onStateEnter(animator, AnimatorMgr.GetTypeByHash(stateInfo.fullPathHash), stateInfo); } }
void SendThrowBomb() { BombData bombData = new BombData(); if (AnimatorMgr.GetIsPlaying(animator, AnimatorType.IdleThrow)) { bombData.startPos = thisGo.transform.position + thisGo.transform.forward + new Vector3(0, 1f, 0); if (Vector3.Distance(thisGo.transform.position, new Vector3(hitPosition.x, thisGo.transform.position.y, hitPosition.z)) > 12) { hitPosition = thisGo.transform.position + (new Vector3(hitPosition.x, thisGo.transform.position.y, hitPosition.z) - thisGo.transform.position).normalized * 12; } } else if (AnimatorMgr.GetIsPlaying(animator, AnimatorType.RunThrow)) { bombData.startPos = thisGo.transform.position + thisGo.transform.forward + new Vector3(0, 2f, 0); if (Vector3.Distance(thisGo.transform.position, new Vector3(hitPosition.x, thisGo.transform.position.y, hitPosition.z)) > 20) { hitPosition = thisGo.transform.position + (new Vector3(hitPosition.x, thisGo.transform.position.y, hitPosition.z) - thisGo.transform.position).normalized * 20; } } bombData.endPos = hitPosition; bombData.durationTime = 2; bombData.damageRange = 8; BombRequest.Instance.SendAddBombRequest(bombData); }