Exemple #1
0
    //a little too unorganised

    public void Start()
    {
        Instantiate(RadiusCircle, getCursorPosition(), RadiusCircle.transform.rotation);
        RadiusCircle       = GameObject.FindGameObjectWithTag("Circle");
        radiusCircleScript = RadiusCircle.GetComponent <RadiusCircle>();
        road = GameObject.FindGameObjectWithTag("Road");
    }
Exemple #2
0
 void Start()
 {
     circle       = GameObject.FindGameObjectWithTag("Circle").GetComponent <RadiusCircle>();
     targetRadius = _Tower.radius;
     circle.SetScale(targetRadius);
     circle.SetColor(Color.white, false);
 }
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Dummy" && collision is BoxCollider2D)
     {
         circleChange = GameObject.FindGameObjectWithTag("Circle").GetComponent <RadiusCircle>();
         //print("Cannot place dummy here");
         canPlace.canBePlaced = false;
         circleChange.SetColor(Color.red, false);
     }
 }
        protected override string Render(RadiusCircle circle)
        {
            var s = new StringBuilder();

            s.AppendLine("ctx.beginPath();");
            s.AppendLine($"ctx.arc({circle.Position.X}, {circle.Position.Y}, {circle.Radius}, 0, 2 * Math.PI);");

            if (circle.Fill)
            {
                s.AppendLine("ctx.fill();");
            }

            if (circle.Stroke)
            {
                s.AppendLine("ctx.stroke();");
            }

            return(s.ToString());
        }
        protected override string Render(RadiusCircle circle)
        {
            if (circle.Fill && circle.Stroke)
            {
                return($@"<circle cx=""{circle.Position.X}"" cy=""{circle.Position.Y}"" r=""{circle.Radius}"" stroke=""{ColorToHtml(StrokeColor)}"" stroke-width=""{StrokeWidth}"" fill=""{ColorToHtml(FillColor)}"" />");
            }

            if (circle.Fill)
            {
                return($@"<circle cx=""{circle.Position.X}"" cy=""{circle.Position.Y}"" r=""{circle.Radius}"" fill=""{ColorToHtml(FillColor)}"" />");
            }

            if (circle.Stroke)
            {
                return($@"<circle cx=""{circle.Position.X}"" cy=""{circle.Position.Y}"" r=""{circle.Radius}"" stroke=""{ColorToHtml(StrokeColor)}"" stroke-width=""{StrokeWidth}"" fill=""none"" />");
            }

            return("");
        }
Exemple #6
0
 protected abstract string Render(RadiusCircle circle);