コード例 #1
0
    public void SpawnParticleOnTargetList(ParticleEventProperties properties, bool applyOnTargetList, float startTime)
    {
        if (!applyOnTargetList)
        {
            return;
        }

        if (Application.isPlaying)  //运行模式是combatant里取targets
        {
            //if (_combatant == null)
            //{
            //    _combatant = GetComponent<Combatant>();
            //}

            //if (_combatant.LTTargets == null) return;
            //Combatant[] tcs = new Combatant[_combatant.LTTargets.Count];

            //if(tcs==null)
            //{
            //    return;
            //}
            //for(int i=0;i<tcs.Length;i++)
            //{
            //    tcs[i] = LTCombatEventReceiver.Instance.GetCombatant(_combatant.LTTargets[i]);
            //}

            //if (targets == null || targets.Length !=tcs.Length)
            //{
            //    targets = new Transform[tcs.Length];
            //}

            //for(int i =0;i< targets.Length;i++)
            //{
            //    if (tcs[i] != null)
            //    {
            //        targets[i] = tcs[i].transform;
            //    }
            //}
        }

        if (targets == null)
        {
            return;
        }

        for (int i = 0; i < targets.Length; i++)
        {
            Transform target = targets[i];
            if (target != null)
            {
                HitMono hitMono = target.GetComponent <HitMono>();
                if (hitMono == null)
                {
                    hitMono = target.gameObject.AddComponent <HitMono>();
                }
                hitMono.SpawnParitcle(properties, !applyOnTargetList, startTime);
            }
        }
    }
コード例 #2
0
    public void SpawnAudioOnTargetList(AudioEventProperties audio_info, bool applyOnTargetList, float startTime)
    {
        if (!applyOnTargetList)
        {
            return;
        }
        if (targets == null)
        {
            return;
        }

        foreach (Transform target in targets)
        {
            if (target != null)
            {
                HitMono hitMono = target.GetComponent <HitMono>();
                if (hitMono == null)
                {
                    hitMono = target.gameObject.AddComponent <HitMono>();
                }
                hitMono.SpawnAudio(audio_info, !applyOnTargetList, startTime);
            }
        }
    }