Beispiel #1
0
    /// param:Id[对应到SkillSceneObjManager中的AttractBullet Id]
    /// example:1
    public void Trigger_AttractShoot(string param)
    {
#if SHOOTER_LOG
        Debug.Log("Trigger_AttractShoot param:" + param);
#endif
        if (m_SceneObjMgr != null)
        {
            SkillSceneObjInfo             sobjInfo   = new SkillSceneObjInfo(param);
            SceneObject_AttractBulletInfo bulletInfo = m_SceneObjMgr.TryGetAttractBulletInfo(sobjInfo.Id);
            MasterWeaponType masterType    = (MasterWeaponType)(sobjInfo.ExtractNumeric <int>(0, 0));
            GameObject       curMainWeapon = TriggerImpl.GetCurMainWeapon(this.gameObject, masterType);
            if (bulletInfo != null && bulletInfo.SceneObjInfo != null && curMainWeapon != null)
            {
                Transform efSpark = LogicSystem.FindChildRecursive(curMainWeapon.transform,
                                                                   Script_Util.ForceNotifyEffectBone(bulletInfo.SceneObjInfo.EffectParentBone));
                if (null == efSpark)
                {
                    Debug.Log("Trigger_AttractShoot bone miss!");
                    return;
                }
                bulletInfo          = bulletInfo.Clone();
                bulletInfo.Attacker = this.gameObject;
                bulletInfo.SceneObjInfo.EffectPos += efSpark.transform.position;
                bulletInfo.MoveStartPos           += efSpark.transform.position;
                bulletInfo.MoveDir = Quaternion.Euler(efSpark.transform.rotation.eulerAngles + bulletInfo.MoveDir) * Vector3.forward;
                bulletInfo.SceneObjInfo.EffectLiftTime = float.MaxValue;
                bulletInfo.ImpactSrcPos += new Vector3(gameObject.transform.position.x,
                                                       efSpark.transform.position.y, gameObject.transform.position.z);
                GameObject tBulletObj = TriggerImpl.PlayEffect(bulletInfo.SceneObjInfo);
                tBulletObj.SendMessage("Active", bulletInfo);
            }
            else
            {
                Debug.Log("Trigger_AttractShoot null!");
            }
        }
    }
Beispiel #2
0
    public static GameObject AttachEffect(SkillEffectInfo info)
    {
        GameObject tEffectObj = null;

        if (info.EffectAsset != null)
        {
            tEffectObj = Script_Util.CreateGameObjectByAsset(info.EffectAsset);
        }
        else
        {
            tEffectObj = Script_Util.CreateGameObjectByName(info.EffectName);
        }
        if (null != tEffectObj)
        {
            bool ret = Script_Util.AttachGameObject(info.EffectParent, tEffectObj.transform, Script_Util.ForceNotifyEffectBone(info.EffectParentBone));
            if (ret)
            {
                tEffectObj.transform.localPosition = info.EffectPos;
                tEffectObj.transform.localRotation = Quaternion.Euler(info.EffectRot);
            }
            if (OnGetSkillSoundInfo != null)
            {
                SkillSoundInfo sInfo = OnGetSkillSoundInfo(info.EffectSoundId);
                if (sInfo != null)
                {
                    TriggerImpl.PlaySoundAtTarget(tEffectObj, sInfo);
                }
            }
            GameObject.Destroy(tEffectObj, Script_Util.ForceNotifyEffectTime(info.EffectLiftTime));
        }
        else
        {
            LogicSystem.GfxLog("AttachEffect effect create failed!");
        }
        return(tEffectObj);
    }