Exemplo n.º 1
0
        // nullable
        public static NetworkSkinModifier Deserialize(DataSerializer s, IPrefabCollection prefabCollection, NetworkSkinLoadErrors errors)
        {
            var type = (NetworkSkinModifierType)s.ReadUInt8();

            switch (type)
            {
            case NetworkSkinModifierType.TerrainSurface:
                return(TerrainSurfaceModifier.DeserializeImpl(s, errors));

            case NetworkSkinModifierType.Color:
                return(ColorModifier.DeserializeImpl(s, errors));

            case NetworkSkinModifierType.StreetLight:
                return(StreetLightModifier.DeserializeImpl(s, prefabCollection, errors));

            case NetworkSkinModifierType.Tree:
                return(TreeModifier.DeserializeImpl(s, prefabCollection, errors));

            case NetworkSkinModifierType.Pillar:
                return(PillarModifier.DeserializeImpl(s, prefabCollection, errors));

            case NetworkSkinModifierType.Catenary:
                return(CatenaryModifier.DeserializeImpl(s, prefabCollection, errors));

            default:
                return(null);
            }
        }
Exemplo n.º 2
0
        public static Color ModifyColor(Color startColor, ColorModifier modifier)
        {
            double lightnessFactor = 1;

            switch (modifier)
            {
            case ColorModifier.Lighten:
                lightnessFactor = 2;
                break;

            case ColorModifier.Darken:
                lightnessFactor = 0.5;
                break;

            default:
                break;
            }

            var hlsColor = RgbToHls(startColor);

            hlsColor.L = hlsColor.L * lightnessFactor;
            var result = HlsToRgb(hlsColor);

            return(result);
        }
Exemplo n.º 3
0
    void Awake()
    {
        this.enemySpawner = GameObject.FindObjectOfType <EnemySpawner>();
        Transform sprite = transform.Find("Sprite");

        this.colorModifier = sprite.GetComponent <ColorModifier>();
        this.hitParticle   = Resources.Load("Prefabs/hitParticleSystem", typeof(GameObject)) as GameObject;
    }
Exemplo n.º 4
0
    public IEnumerator ApplyPowerUp(GameObject Other)
    {
        PaddleController Paddle = Other.GetComponent <PaddleController>();

        // If the other component alread has a power up destroy the power up now
        if (Paddle.HasPowerUp)
        {
            Destroy(gameObject);
            yield return(null);
        }

        //
        GetComponent <SpriteRenderer>().enabled = false;
        GetComponent <BoxCollider2D>().enabled  = false;

        switch (PowerUpType)
        {
        case Type.LARGE_PADDLE:
            Paddle.HasPowerUp          = true;
            Other.transform.localScale = new Vector3(100f, 200f);
            yield return(new WaitForSeconds(PowerUpTime));

            Paddle.HasPowerUp          = false;
            Other.transform.localScale = new Vector3(100f, 100f);
            break;

        case Type.MAGNETIC_PADDLE:
            Paddle.IsMagnetic = true;
            Paddle.HasPowerUp = true;
            Other.GetComponent <ColorModifier>().ModifierMode = ColorModifier.ColorMode.FIXED;
            Other.GetComponent <ColorModifier>().SetColor(new Color(1, 1, 1));
            yield return(new WaitForSeconds(PowerUpTime));

            Paddle.IsMagnetic = false;
            Paddle.HasPowerUp = false;
            GameObject.Find("Ball").GetComponent <BallComponent>().CurrentStatus = BallComponent.Status.Moving;
            Other.GetComponent <ColorModifier>().ModifierMode = ColorModifier.ColorMode.TIME_BASED;
            break;

        case Type.STRONG_BALL:
            BallComponent Ball      = GameObject.Find("Ball").GetComponent <BallComponent>();
            ColorModifier BallColor = GameObject.Find("Ball").GetComponent <ColorModifier>();

            Paddle.HasPowerUp      = true;
            Ball.isOnFire          = true;
            BallColor.ModifierMode = ColorModifier.ColorMode.FIXED;
            BallColor.SetColor(new Color(1f, 0f, 0f));
            yield return(new WaitForSeconds(PowerUpTime));

            Paddle.HasPowerUp      = false;
            BallColor.ModifierMode = ColorModifier.ColorMode.TIME_BASED;
            Ball.isOnFire          = false;
            break;
        }

        // Destroy the object
        Destroy(gameObject);
    }
Exemplo n.º 5
0
    void Start()
    {
        radialFillControl = GameObject.FindObjectOfType <RadialFillControl> ();
        attackMaskControl = GameObject.FindObjectOfType <AttackMaskControl> ();
        int dictIndex = 1;

        foreach (BossAttack attack in AttackLists.chosenAttacksArray)
        {
            if (attack != null)
            {
                attackDict.Add(dictIndex, attack);
                dictIndex++;
            }
        }

        if (attackDict[1].frequency < Parameters.SLOW_ATTACK_LIMIT)
        {
            setAttack(1);
        }
        else
        {
            foreach (KeyValuePair <int, BossAttack> keyVal in attackDict)
            {
                if (keyVal.Value.frequency < Parameters.SLOW_ATTACK_LIMIT)
                {
                    setAttack(keyVal.Key);
                    break;
                }
            }
        }



        Transform aim = UnityUtils.RecursiveFind(transform, "Image");

        this.aimColorModifier = aim.GetComponent <ColorModifier>();
        aimColorModifier.SetDefaultColor(Parameters.AIM_DEFAULT_COLOR);
        aimColorModifier.SetSelectedColor(Parameters.AIM_DAMAGE_COLOR);

        UnityUtils.RecursiveFind(transform, "Image").GetComponent <Image>().color = Parameters.AIM_DEFAULT_COLOR;
    }
Exemplo n.º 6
0
    void Start()
    {
        this.character1 = StaticCharacterHolder.characters [1 - 1];
        this.character2 = StaticCharacterHolder.characters [2 - 1];
        pauseMenu       = GameObject.Find("PauseMenu");
        pauseMenu.SetActive(false);
        timeUntilPressAnyKey  = 1.0f;
        pauseBackgroundToggel = GameObject.Find("PauseBackground").GetComponent <ColorModifier> ();
        pauseBackgroundToggel.SetDefaultColor(new Color32(0, 0, 0, 0));
        pauseBackgroundToggel.SetSelectedColor(new Color32(120, 120, 120, 160));
        healthBars = new ProgressBarBehaviour[StaticCharacterHolder.characters.Count];
        ProgressBarBehaviour character1HealthBar = GameObject.Find("Character1HealthBar").GetComponent <ProgressBarBehaviour> ();

        healthBars [0] = character1HealthBar;
        ProgressBarBehaviour character2HealthBar = GameObject.Find("Character2HealthBar").GetComponent <ProgressBarBehaviour> ();

        character2HealthBar.SetDirection(-1);          //Flip the health bar on the right.
        healthBars[1]   = character2HealthBar;
        winnerText      = GameObject.Find("WinnerText").GetComponent <Text> ();
        pressAnyKeyText = GameObject.Find("PressAnyKeyText").GetComponent <Text> ();
        gameOver        = false;
        paused          = false;
    }
Exemplo n.º 7
0
 public RelativeColorExtension(ColorModifier modifier, Color startColor)
 {
     Modifier   = modifier;
     StartColor = startColor;
 }
Exemplo n.º 8
0
    public static IEnumerator ChangeToDefaultColorAfterTime(ColorModifier colorModifier, float time)
    {
        yield return(new WaitForSeconds(time));

        colorModifier.DeSelect();
    }
Exemplo n.º 9
0
 public ColorModifierEditor(SplineUser user, SplineUserEditor editor, ColorModifier input) : base(user, editor, input)
 {
     module = input;
     title  = "Color Modifiers";
 }