From 15eb052cddb4cc7255438ad7ad7ae369d0c9d1ca Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期二, 22 一月 2019 14:00:15 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 Fight/Actor/Skill/AttackHandler.cs |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/Fight/Actor/Skill/AttackHandler.cs b/Fight/Actor/Skill/AttackHandler.cs
index 6e9fd2f..0236029 100644
--- a/Fight/Actor/Skill/AttackHandler.cs
+++ b/Fight/Actor/Skill/AttackHandler.cs
@@ -36,10 +36,18 @@
 
         if (_hitEffectId != -1)
         {
-            SFXController _controller = SFXPlayUtility.Instance.PlayEffectAsync(_hitEffectId,
-                                                                                 target.MP_Hit.position,
-                                                                                 Vector3.forward);
-            _controller.transform.rotation = CameraController.Instance.CameraObject.transform.rotation * Quaternion.Euler(0, 0, Random.Range(0, 360));
+            SFXController _controller = target.MP_Hit ?
+                SFXPlayUtility.Instance.PlayEffectAsync(_hitEffectId,
+                                                        target.MP_Hit.position,
+                                                        Vector3.forward) :
+                SFXPlayUtility.Instance.PlayEffectAsync(_hitEffectId,
+                                                        target.Root.position,
+                                                        Vector3.forward);
+
+            if (CameraController.Instance.CameraObject)
+            {
+                _controller.transform.rotation = CameraController.Instance.CameraObject.transform.rotation * Quaternion.Euler(0, 0, Random.Range(0, 360));
+            }
 
             // 鎾斁鍙楀嚮闊虫晥
             if (target.ActorType == GameObjType.gotNPC)
@@ -62,11 +70,13 @@
 
                 if (soConfig.hitEffectId != 0)
                 {
-                    SFXController _controller = SFXPlayUtility.Instance.PlayEffectAsync(soConfig.hitEffectId,
-                                                                                        target.MP_Hit.position,
-                                                                                        Vector3.forward);
-                    _controller.transform.rotation = CameraController.Instance.CameraObject.transform.rotation * Quaternion.Euler(0, 0, Random.Range(0, 360));
-
+                    SFXController _controller = target.MP_Hit
+                        ? SFXPlayUtility.Instance.PlayEffectAsync(soConfig.hitEffectId,
+                                                                  target.MP_Hit.position,
+                                                                  Vector3.forward) :
+                          SFXPlayUtility.Instance.PlayEffectAsync(soConfig.hitEffectId,
+                                                                  target.Root.position,
+                                                                  Vector3.forward);
                     // 鎾斁鍙楀嚮闊虫晥
                     if (target.ActorType == GameObjType.gotNPC)
                     {

--
Gitblit v1.8.0