void OnCollisionStay2D(Collision2D col) { if (m_target == null) { return; } m_attackTick += Time.deltaTime; // MDebug.Log("Tick " + string.Format("{0:F1}" , tick)); if (m_attackTick <= 0.5f) { return; } m_attackTick = 0.0f; Hero hero = m_target.GetComponent <Hero>(); if (hero != null) { if (hero.IS_PLAYER) { hero.Damage(1, m_skeletonAnimation.skeleton.flipX, 500.0f); } else { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCharacterHPUpdate(hero.USERNAME, 10, GameSetting.HERO_MAX_HP)); } } CheckAndSetAnimation(0, ANI_MOVE, true); }
private void State_Complete(Spine.TrackEntry trackEntry) { if (trackEntry.animation.name.Equals(ANI_ATTACK)) { m_curState = "idle"; Hero hero = m_heroTarget; if (hero != null) { if (hero.IS_PLAYER) { hero.Damage(1, m_skeletonAnimation.skeleton.flipX); } else { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonCharacterHPUpdate(hero.USERNAME, 1, GameSetting.HERO_MAX_HP)); } } m_skeletonAnimation.state.SetAnimation(0, ANI_IDLE, true); // m_target = null; } }