Esempio n. 1
0
        public MainPage()
        {
            this.InitializeComponent();

            LoadApplication(new Essentials.Samples.App());
            CircleRenderer.Init();
        }
Esempio n. 2
0
    private void Start()
    {
        player       = transform.GetChild(0);
        playerScript = player.GetComponent <PlayerController>();
        rend         = GetComponent <CircleRenderer>();

        PlayerController.playerDied += OnPlayerDied;
    }
Esempio n. 3
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            CircleRenderer.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
Esempio n. 4
0
 private void OnGUI()
 {
     circleRenderer = (CircleRenderer)EditorGUILayout.ObjectField(circleRenderer, typeof(CircleRenderer), true);
     if (circleRenderer)
     {
         circleRenderer.Radius   = EditorGUILayout.FloatField("Radius", circleRenderer.Radius);
         circleRenderer.Segments = EditorGUILayout.IntSlider("Segments", circleRenderer.Segments, 3, 20);
     }
 }
Esempio n. 5
0
        public SimpleBall(Vector2f _pos, Color _color, int _size)
        {
            gameObject = new GameObject(_pos);


            CircleRenderer c = new CircleRenderer(gameObject, (uint)_size, _color);
            gameObject.AddComponent(c);
            

        }
Esempio n. 6
0
        public TransformControl(Transform transform)
        {
            this.transform               = transform;
            positionCircle               = new Transform(Matrix3x3.identity);
            positionCircle.parent        = transform;
            positionCircle.localPosition = GetCircleLocalPosition();
            positionCircle.localScale    = GetCircleLocalScale();

            positionCircleRenderer       = new CircleRenderer(positionCircle, GetExitColor());
            positionCircleRenderer.layer = DrawLayer.UI;
        }
Esempio n. 7
0
    private void Start()
    {
        boundary    = FindObjectOfType <WorldBoundary>();
        rend        = GetComponent <CircleRenderer>();
        rend.radius = rend.radius / (iteration + 2);

        float velocityMagnitude = velocityMultiplier * (iteration + 1);

        velocity = new Vector2(Random.Range(-velocityMagnitude, velocityMagnitude), Random.Range(-velocityMagnitude, velocityMagnitude));

        gameObject.GetComponent <MeshCollider>().sharedMesh = MeshGenerator.GeneratePolygonMesh(rend.circlePoints);
    }
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            CrossCurrentActivity.Current.Init(this, bundle);
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            CircleRenderer.Init();
            LoadApplication(new App());
        }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        input = GetComponent <InputMap>();
        rb    = GetComponent <Rigidbody2D>();
        sr    = GetComponent <SpriteRenderer>();
        cr    = GetComponent <CircleRenderer>();

        //solve for gravity and jumpSpeed based on timeToJumpApex and jumpHeight
        //d = vi * t + (1/2) * a * t^2 where vi = initial jump velocity = 0
        //d = (1/2) * a * t^2
        gravity           = (2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        Physics2D.gravity = new Vector2(Physics2D.gravity.x, -gravity);
        jumpSpeed         = gravity * timeToJumpApex;
    }
Esempio n. 10
0
    // Use this for initialization
    void Start()
    {
        var allWaypoints = GameObject.FindGameObjectsWithTag("Waypoints");
        var closestDist  = Mathf.Infinity;

        if (allWaypoints.Length == 0)
        {
            Debug.LogError("Couldn't find any waypoints!");
        }

        foreach (var waypoint in allWaypoints)
        {
            var distance = Vector2.Distance(this.transform.position, waypoint.transform.position);
            if (distance < closestDist)
            {
                closestDist = distance;
                _waypoint   = waypoint;
            }

            _sdn = GameObject.FindObjectOfType <SDN> ();
            if (_sdn == null)
            {
                throw new UnassignedReferenceException("Couldn't find the SDN object!");
            }
        }

        // Add to vehicle list
        _sdn.addToVehicleList(this);

        Debug.Assert(_waypoint != null, "Unable to find any waypoints on initialize!");
        status           = Status.Go;
        currSpeed        = vehicle.Speed;
        stoplight        = null;
        showSearchRadius = false;

        radiusRenderer         = GetComponent <CircleRenderer>();
        radiusRenderer.enabled = true;
        if (showSearchRadius)
        {
            radiusRenderer.lineWidth = 0.5f;
            radiusRenderer.radius    = searchRadius;
        }
        else
        {
            radiusRenderer.lineWidth = 0f;
        }
        radiusRenderer.DoRenderer();
    }
Esempio n. 11
0
        public Ball(Vector2f pos, Color _color, int _size, float _friction)
        {
            gameObject = new GameObject(pos);


            CircleRenderer c = new CircleRenderer(gameObject, (uint)_size, _color);
            gameObject.AddComponent(c);

            PhysicsBody p = new PhysicsBody(gameObject);
            //p.size = _size;
            p.bounce = _friction;
            gameObject.AddComponent(p);


            CircleCollider circleCollider = new CircleCollider(gameObject, _size);
            gameObject.AddComponent(circleCollider);
            Game.CollisionHandler.AddDynamicCollider(circleCollider);

        }
Esempio n. 12
0
    // Use this for initialization

    void Awake()
    {
        _sbsm  = gameObject.GetComponent <SensorModule>();
        _sbotv = gameObject.GetComponent <ObjectTypeVisible>();

        GameObject SenObj = Instantiate(SensorsLine, gameObject.transform.position, gameObject.transform.rotation);

        SensorsLine = SenObj;
        _scr        = SenObj.GetComponent <CircleRenderer>();
        _sespa      = SenObj.GetComponent <EnterSelectPlaneActive>();
        GameObject WepObj = Instantiate(WeaponLine, gameObject.transform.position, gameObject.transform.rotation);

        WeaponLine = WepObj;
        _wcr       = WepObj.GetComponent <CircleRenderer>();
        _wespa     = WepObj.GetComponent <EnterSelectPlaneActive>();

        _sespa.Owner = gameObject;

        _wespa.Owner = gameObject;
    }
Esempio n. 13
0
        public Player()
        {
            gameobject = new GameObject(new Vector2f(0, 300));

            //RectRenderer rc = new RectRenderer(gameobject, new Vector2f(50, 50), new Color(224, 131, 38));
            //gameobject.AddComponent(rc);

            CircleRenderer c = new CircleRenderer(gameobject, 25, new Color(224, 131, 38));
            gameobject.AddComponent(c);

            PhysicsBody p = new PhysicsBody(gameobject);
            p.bounce = 0.75f;
            gameobject.AddComponent(p);

            InputMoveable im = new InputMoveable(gameobject, 2000);
            gameobject.AddComponent(im);

            CircleCollider circleCollider = new CircleCollider(gameobject, 25);
            gameobject.AddComponent(circleCollider);
            Game.CollisionHandler.AddDynamicCollider(circleCollider);
        }
Esempio n. 14
0
    // Use this for initialization
    void Awake()
    {
        if (gameObject.GetComponent <ObjectTypeVisible>())
        {
            _otv = gameObject.GetComponent <ObjectTypeVisible>();
        }

        _HP = gameObject.GetComponent <HealthModule>();
        if (!NonPhysicalMovement)
        {
            _agent = gameObject.GetComponent <MoveComponent>();
        }

        GameObject SenObj = Instantiate(SensorsLine, gameObject.transform.position, gameObject.transform.rotation);

        SensorsLine = SenObj;
        _scr        = SenObj.GetComponent <CircleRenderer>();
        _sespa      = SenObj.GetComponent <EnterSelectPlaneActive>();
        GameObject WepObj = Instantiate(WeaponLine, gameObject.transform.position, gameObject.transform.rotation);

        WeaponLine = WepObj;
        _wcr       = WepObj.GetComponent <CircleRenderer>();
        _wespa     = WepObj.GetComponent <EnterSelectPlaneActive>();

        _sespa.Owner = gameObject;

        _wespa.Owner = gameObject;

        _es = gameObject.GetComponent <SensorModule>();

        if (StartLocation == null)
        {
            targetVector = transform.position;
        }
        else
        {
            _agent.Movement(StartLocation.transform.position);
        }
    }
Esempio n. 15
0
    private void Start()
    {
        Definitions.DefinitionStart();

        //Some rendering initialization
        drawLine = GetComponent <LineRenderer>();

        startCircle  = GetChild(this.gameObject, "StartCircle");
        endCircle    = GetChild(this.gameObject, "EndCircle");
        circleBounds = GetChild(this.gameObject, "CircleBounds");

        startRend        = startCircle.GetComponent <SpriteRenderer>();
        startLineRend    = startCircle.GetComponent <LineRenderer>();
        endRend          = endCircle.GetComponent <SpriteRenderer>();
        circleBoundsRend = circleBounds.GetComponent <LineRenderer>();

        Color drawLineColor  = drawLine.startColor;
        Color startLineColor = startLineRend.startColor;

        //Color circleBoundsColor = circleBoundsRend.startColor;

        drawLineColor.a  = drawLineAlpha;
        startLineColor.a = startLineAlpha;
        //circleBoundsColor.a = circleBoundsAlpha;

        circleBoundsGradient = new Gradient();

        cb_colorKey          = new GradientColorKey[2];
        cb_colorKey[0].color = cb_colorKey[1].color = Color.white;
        cb_colorKey[0].time  = 0;
        cb_colorKey[1].time  = 1;

        cb_alphaKey          = new GradientAlphaKey[5];
        cb_alphaKey[0].alpha = cb_alphaKey[1].alpha = cb_alphaKey[3].alpha = cb_alphaKey[4].alpha = 0;
        cb_alphaKey[2].alpha = circleBoundsMaxAlpha;
        cb_alphaKey[0].time  = 0;
        cb_alphaKey[1].time  = .43f;
        cb_alphaKey[2].time  = .5f;
        cb_alphaKey[3].time  = .57f;
        cb_alphaKey[4].time  = 1;

        circleBoundsGradient.SetKeys(cb_colorKey, cb_alphaKey);
        circleBoundsRend.colorGradient = circleBoundsGradient;

        drawLine.startColor      = drawLine.endColor = drawLineColor;
        startLineRend.startColor = startLineRend.endColor = startLineColor;

        parentCanvas = transform.parent.GetComponent <Canvas>();

        minRadius = Definitions.mainCamera.pixelHeight * minRatio;
        maxRadius = Definitions.mainCamera.pixelHeight * maxRatio;

        startCircleRend    = startCircle.GetComponent <CircleRenderer>();
        circleBoundsCircle = circleBounds.GetComponent <CircleRenderer>();

        //get the size to for rendering the touch min and max radiuses for the player
        startCircleRend._horizRadius    = startCircleRend._vertRadius = (minRadius / Definitions.visiblePixelsPerUnitRatio) * (1 / startCircle.transform.localScale.x) * (1 / transform.localScale.x) * (1 / parentCanvas.transform.localScale.x);
        circleBoundsCircle._horizRadius = circleBoundsCircle._vertRadius = (maxRadius / Definitions.visiblePixelsPerUnitRatio) * (1 / circleBounds.transform.localScale.x) * (1 / transform.localScale.x) * (1 / parentCanvas.transform.localScale.x);
        startCircleRend.CreatePoints();
        circleBoundsCircle.CreatePoints();

        circleBoundsRenderThresholdRadius = maxRadius * circleBoundsRenderThreshold;
    }
 public void UpdateTurningCircleValues(CircleRenderer cir)
 {
     cir.center  = C;
     cir.xradius = R;
     cir.yradius = R;
 }
Esempio n. 17
0
 void Awake()
 {
     circ    = transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>();
     circGFX = transform.GetChild(1).GetComponent <CircleRenderer>();
     step    = 0.8f / (DTime * 60f);
 }
Esempio n. 18
0
    private void OnSceneGUI()
    {
        renderer = target as CircleRenderer;

        renderer.Radius = (Handles.RadiusHandle(Quaternion.identity, renderer.transform.position, renderer.Radius));
    }