Beispiel #1
0
    public Ability BuildAbility(EntityView entityView, AudioAssetData audioAsset)
    {
        var ability = Instantiate(abilityPrefab, entityView.transform);

        ability.name = abilityPrefab.name;
        ability.transform.localPosition = position;
        if (ability is ColliderAbility)
        {
            ((ColliderAbility)ability).targetTags = targetTags;
        }

        if (ability is IAbility)
        {
            ((IAbility)ability).SetAudioAsset(audioAsset);
            ((IAbility)ability).SetFields(GetDictionary());
        }

        if (ability is IListenable)
        {
            ((IListenable)ability).AddGraphicsListener(entityView.unitGraphics);
        }

        if (ability is ILastActionable)
        {
            ((ILastActionable)ability).AddLastActionListener(() => entityView.SelfDestruct(false));
        }

        if (ability is ISpawnable)
        {
            ((ISpawnable)ability).AttachSpawn(spawn);
        }
        return(ability);
    }
Beispiel #2
0
    private static AudioAssetData PushToPool(int iAssetID, AudioClip iClip, bool iAdd, float iVolumeScale)
    {
        AudioAssetData audioAssetData = new AudioAssetData
        {
            assetID      = iAssetID,
            audio        = iClip,
            isAdditional = iAdd,
            volumeScale  = iVolumeScale
        };

        AudioAssetPool.mAudioClipCache.set_Item(iAssetID, audioAssetData);
        return(audioAssetData);
    }
Beispiel #3
0
    public static void EnqueueAudioRequest(AudioPlayer apTarget, AudioAssetData aad)
    {
        Queue <AudioRequest> queue = AudioAssetPool.mSEQueue;

        lock (queue)
        {
            AudioRequest audioRequest = new AudioRequest
            {
                iPlayer = apTarget,
                iCache  = aad
            };
            AudioAssetPool.mSEQueue.Enqueue(audioRequest);
        }
    }
Beispiel #4
0
    public void PlayBGMByID(int templateId)
    {
        if (!this.IsBGMOn())
        {
            return;
        }
        if (this.mBGMSource == null || this.mBGMSource.get_mute())
        {
            return;
        }
        if (templateId <= 0)
        {
            return;
        }
        AudioAssetData audioAssetNow = AudioAssetPool.GetAudioAssetNow(templateId);

        if (audioAssetNow != null)
        {
            this.bgmVolumeScale = audioAssetNow.volumeScale;
            this.currentBGVolum = this.bgmVolumeScale;
            this.PlayBGM(audioAssetNow.audio, 0.8f, null);
        }
    }
Beispiel #5
0
 public void SetAudioAsset(AudioAssetData audioAsset)
 {
     assetData = audioAsset;
 }
Beispiel #6
0
 public void SetAudioAsset(AudioAssetData audioAsset)
 {
     throw new System.NotImplementedException();
 }