Exemple #1
0
    public void playEffectNow(sdGameActor _gameActor)
    {
        if (stateData == null)
        {
            return;
        }
        Hashtable data = stateData;

        if (data.Contains("EffectFile") && data.Contains("EffectAnchor") && data.Contains("EffectLifeTime"))
        {
            string[] fileName = (string[])data["EffectFile"];
            if (fileName.Length == 0)
            {
                return;
            }
            string[] anchorNameArray = (string[])data["EffectAnchor"];
            if (anchorNameArray.Length == 0)
            {
                return;
            }
            int[] effectLifeTime = (int[])data["EffectLifeTime"];
            if (effectLifeTime.Length == 0)
            {
                return;
            }
            Vector3    effectPosition = Vector3.zero;
            Quaternion rot            = Quaternion.identity;
            if (anchorNameArray[0] == "gamelevel")
            {
                effectPosition = _gameActor.transform.position;
                rot            = _gameActor.transform.rotation;
            }
            _gameActor.attachEffect(fileName[0], anchorNameArray[0], effectPosition, rot, 1.0f, effectLifeTime[0] * 0.001f);
        }
    }
Exemple #2
0
    public void playEffect(sdGameActor _gameActor)
    {
        if (stateData == null)
        {
            return;
        }
        if (aniState == null)
        {
            return;
        }
        Hashtable data = stateData;

        if (data.Contains("EffectFile") && data.Contains("EffectStartTime") && data.Contains("EffectAnchor") && data.Contains("EffectLifeTime"))
        {
            string[] fileName = (string[])data["EffectFile"];
            if (fileName.Length == 0)
            {
                return;
            }
            int[] effectStartTime = (int[])data["EffectStartTime"];
            if (effectStartTime.Length == 0)
            {
                return;
            }
            string[] anchorNameArray = (string[])data["EffectAnchor"];
            int[]    effectLifeTime  = (int[])data["EffectLifeTime"];
            for (int index = 0; index < effectStartTime.Length && index < fileName.Length && index < anchorNameArray.Length && index < effectLifeTime.Length; ++index)
            {
                float testpoint = (float)effectStartTime[index] * 0.0001f;
                if (testpoint > _gameActor.PreviousEffectTime && testpoint <= aniState.normalizedTime)
                {
                    Vector3    effectPosition = Vector3.zero;
                    Quaternion rot            = Quaternion.identity;
                    if (anchorNameArray[index] == "gamelevel")
                    {
                        effectPosition = _gameActor.transform.position;
                        rot            = _gameActor.transform.rotation;
                    }
                    _gameActor.attachEffect(fileName[index], anchorNameArray[index], effectPosition, rot, 1.0f, effectLifeTime[index] * 0.001f);
                }
            }
            _gameActor.PreviousEffectTime = aniState.normalizedTime;
        }
    }