示例#1
0
 void Start()
 {
     Time.timeScale = 1;
     // Repeat change every 3 seconds
     InvokeRepeating(nameof(changeEnvironment), startChangeAfterSeconds, changeRate);
     endPlatformAnimator = levels[curLevel].GetPlatforms()[levels[curLevel].GetPlatforms().Length - 1]
                           .platform.GetComponent <Animator>();
     death_effect = Camera.main.GetComponent <deathEffect>();
 }
示例#2
0
    void Awake()
    {
        // Register the singleton
        if (Instance != null)
        {
            Debug.LogError("Multiple instances of deathEffect!");
        }

        Instance = this;
        blockEffect.GetComponent <Renderer>().sortingLayerName = "Foreground";
    }
示例#3
0
    public void AddEffect(ElementalType type, int shapeId)
    {
        Debug.Log("Add effect: " + gameObject.tag);
        switch (type)
        {
        case ElementalType.fire:
            FireEffect fireEffect = new FireEffect();

            fireEffect.spellType = ElementalType.fire;
            fireEffect.shapeId   = shapeId;
            fireEffect.monster   = gameObject;

            fireEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(fireEffect);
            break;

        case ElementalType.ice:
            IceEffect iceEffect = new IceEffect();

            iceEffect.spellType = ElementalType.ice;
            iceEffect.shapeId   = shapeId;
            iceEffect.monster   = gameObject;

            iceEffect.InitEffect(10f, 1f, 0.5f, 5f);

            spellEffects.Add(iceEffect);
            break;

        case ElementalType.earth:
            earthEffect earthEffect = new earthEffect();

            earthEffect.spellType = ElementalType.earth;
            earthEffect.shapeId   = shapeId;
            earthEffect.monster   = gameObject;

            earthEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(earthEffect);
            break;

        case ElementalType.death:
            deathEffect deathEffect = new deathEffect();

            deathEffect.spellType = ElementalType.death;
            deathEffect.shapeId   = shapeId;
            deathEffect.monster   = gameObject;

            deathEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(deathEffect);
            break;

        case ElementalType.poison:
            poisonEffect poisonEffect = new poisonEffect();

            poisonEffect.spellType = ElementalType.poison;
            poisonEffect.shapeId   = shapeId;
            poisonEffect.monster   = gameObject;

            poisonEffect.InitEffect(10f, 1f, 5f, 1f, 10f);

            spellEffects.Add(poisonEffect);
            break;

        default:
            break;
        }
    }