Пример #1
0
    public void Init(Vector2 position, float rotation, float FPS, Color colour, Sprite[] sprites, HitEffectLightMode lightMode)
    {
        index     = 0;
        timer     = 0;
        Colour    = colour;
        this.FPS  = FPS;
        Sprites   = sprites;
        LightMode = lightMode;

        // 0, 9 or 10
        // 0 is default (lit)
        // 9 is Light Source
        // 10 is Unlit
        switch (LightMode)
        {
        case HitEffectLightMode.LIGHT:
            gameObject.layer = 9;
            break;

        case HitEffectLightMode.UNLIT:
            gameObject.layer = 10;
            break;

        case HitEffectLightMode.LIT:
            gameObject.layer = 0;
            break;
        }

        transform.position = position;
        transform.rotation = Quaternion.identity;
        transform.Rotate(0, 0, rotation);
    }
Пример #2
0
    public static void Spawn(Vector2 position, float rotation, float FPS, Color colour, Sprite[] sprites, HitEffectLightMode lightMode)
    {
        GameObject prefab = Spawnables.I.HitEffect;
        GameObject go     = ObjectPool.Instantiate(prefab, PoolType.HIT_EFFECT);

        HitEffect effect = go.GetComponent <HitEffect>();

        effect.Init(position, rotation, FPS, colour, sprites, lightMode);
    }