Пример #1
0
    private void UpdateText()
    {
        CoinText.text   = Coin.ToString();
        PoisonText.text = Essence.ToString();

        if (UpgradeCoin[UpgradeCount] != -1)
        {
            UpgradeButtonEffect.color = new Color(1, 1, 1, (float)Coin / UpgradeCoin[UpgradeCount]);
        }
        else
        {
            UpgradeButtonEffect.color = Color.white;
        }
    }
Пример #2
0
        private void DrawEssence(Essence essence)
        {
            Point p;

            //extra:
            if (selected_hover_essence != null && essence == selected_hover_essence)
            {
                //info
                p = new Point((int)(essence.p.X + essence.radius * 1.5f), (int)(essence.p.Y + essence.radius * 1.5f));

                DrawText(essence.ToString(), p, brush_shadow_70);
            }

            //animation:
            if (essence.timer_creation > 0)
            {
                int x1, x2;
                x1 = (int)(env.ai.timer_creation / env.timeInterval);
                x1 = f.NumberBound(x1, 1);
                x2 = (int)(essence.timer_creation / env.timeInterval);
                x2 = f.NumberBound(x2, 1);
                DrawRipple(essence.p, essence.radius * 10f, essence.radius, x1, x2, brush_shadow_70);
                essence.timer_creation -= env.timeInterval;
            }

            //glow
            if (essence.shell == null)
            {
                DrawCircle(essence.p, essence.radius * 2.0f, brush_shadow_20, null);
                DrawCircle(essence.p, essence.radius * 1.5f, brush_shadow_50, null);
            }

            switch (essence.type)
            {
            case 0:
                //protein
                //main:

                //Point p;
                //PointF dir;

                //hollow circle
                DrawCircle(essence.p, essence.radius);

                ////draw tail if no shell:
                //if (essence.shell == null)
                //{
                //    dir = f.Opposite(essence.velocity);
                //    if (dir == new PointF())
                //    {
                //        dir = new PointF(0, -1);
                //    }
                //    dir = f.Offset(dir, essence.radius);
                //    dir = f.Multiply(dir, tail_offset_coefficient);

                //    p = f.Ceiling(f.Add(essence.p, dir));

                //    DrawCircle(p, tail_radius, null, Brushes.White);
                //}
                break;

            case 1:
                //carbo
                //3 swirling circles
                //main:

                float radius = 1.5f;
                float speed  = 0.1f;

                Point p1, p2, p3;

                p1 = new Point();
                p2 = new Point();
                p3 = new Point();

                p1.X = (int)(Math.Cos(env.counter * speed) * essence.radius);
                p1.Y = (int)(Math.Sin(env.counter * speed) * essence.radius);

                p2.X = (int)(Math.Cos(env.counter * speed + 1.3f / 2f * Math.PI) * essence.radius);
                p2.Y = (int)(Math.Sin(env.counter * speed + 1.3f / 2f * Math.PI) * essence.radius);

                p3.X = (int)(Math.Cos(env.counter * speed + 2.7f / 2f * Math.PI) * essence.radius);
                p3.Y = (int)(Math.Sin(env.counter * speed + 2.7f / 2f * Math.PI) * essence.radius);

                p1 = f.Add(p1, f.ConvertTo(essence.p));
                p2 = f.Add(p2, f.ConvertTo(essence.p));
                p3 = f.Add(p3, f.ConvertTo(essence.p));

                DrawCircle(p1, radius, null, Brushes.White);
                DrawCircle(p2, radius, null, Brushes.White);
                DrawCircle(p3, radius, null, Brushes.White);

                break;
            }
        }