// Update is called once per frame
    void Update()
    {
        RaycastHit2D hit = Physics2D.Raycast (PlayerInformation.Instance.gameObject.transform.position, new Vector2 (Mathf.Cos (bulInfo.travelAngle * Mathf.Deg2Rad), Mathf.Sin (bulInfo.travelAngle * Mathf.Deg2Rad)), 74f , mask, -5, 5);
        if(hit)
        {
            if(hit.collider.tag == "Asteroid")
            {
                hit.collider.gameObject.GetComponent<Asteroid>().Damage(bulInfo.damageRate * Time.deltaTime);
                gameObject.transform.localScale = new Vector3( Vector2.Distance(PlayerInformation.Instance.gameObject.transform.position, hit.collider.gameObject.transform.position) , 2.0f ,1.0f);
                resize = ResizeEvent.hitSize;
            }
            else if(hit.collider.tag == "Enemy")
            {
                gameObject.GetComponent<EnemyInfo>().ApplyDamage(bulInfo.damageRate * Time.deltaTime);
                gameObject.transform.localScale = new Vector3( Vector2.Distance(PlayerInformation.Instance.gameObject.transform.position, hit.collider.gameObject.transform.position), 2.0f ,1.0f);
                resize = ResizeEvent.hitSize;
            }
        }

        if(resize != ResizeEvent.hitSize && resize != ResizeEvent.standby)
        {
            gameObject.transform.localScale = new Vector3( 75f , 2.0f ,1.0f);
            resize = ResizeEvent.standby;
        }
        else if(resize == ResizeEvent.hitSize)
        {
            resize = ResizeEvent.standardSize;
        }
    }
        public virtual bool Handle(IEvent evt)
        {
            ResizeEvent resizeEvent = evt as ResizeEvent;

            if (resizeEvent != null)
            {
                HandleResize(resizeEvent.Width, resizeEvent.Height);
            }

            return(false);
        }
Exemple #3
0
        public override bool Handle(IEvent evt)
        {
            ResizeEvent resizeEvt = evt as ResizeEvent;

            if (resizeEvt != null)
            {
                HandleResize(resizeEvt.Width, resizeEvt.Height);
            }

            return(base.Handle(evt));
        }
Exemple #4
0
        public static void SetWindowDimensions(int width, int height)
        {
            WindowHeight = height;
            WindowWidth  = width;
            windowRatio  = (float)width / height;

            if (ResizeEvent != null)
            {
                ResizeEvent.Invoke();
            }
        }
        public bool Handle(IEvent evt)
        {
            ResizeEvent resizeEvent = evt as ResizeEvent;

            if (resizeEvent != null)
            {
                HandleResizeEvent(resizeEvent);
            }

            return(false);
        }
Exemple #6
0
        public GridRenderer(
            ISurface surface,

            RenderEvent onRenderEvent = null,
            ResizeEvent onResize      = null
            )
        {
            _render  = onRenderEvent;
            _surface = surface ?? throw new ArgumentNullException(nameof(surface));
            onRenderEvent?.Subscribe(OnRender);
            onResize?.Subscribe(OnResize);
        }
        public bool Handle(IEvent evt)
        {
            ResizeEvent resizeEvent = evt as ResizeEvent;

            if (resizeEvent != null)
            {
                Bounds = new Rectangle(0, 0,
                                       resizeEvent.Width,
                                       resizeEvent.Height);
            }

            return(false);
        }
Exemple #8
0
 public RenderWindow(
     MouseButtonEvent mouseButtonEvent = null,
     RenderEvent renderEvent           = null,
     SysCommandEvent sysCommandEvent   = null,
     ResizeEvent resizeEvent           = null,
     CloseEvent closeEvent             = null,
     InitializeEvent initializeEvent   = null,
     CreateEvent createEvent           = null)
 {
     _mouseButtonEvent = mouseButtonEvent;
     _renderEvent      = renderEvent;
     _sysCommandEvent  = sysCommandEvent;
     _resizeEvent      = resizeEvent;
     _closeEvent       = closeEvent;
     _initializeEvent  = initializeEvent;
     _createEvent      = createEvent;
 }
Exemple #9
0
        public override bool Handle(IEvent evt)
        {
            for (int i = 0; i < _widgets.Count; i++)
            {
                if (_widgets[i].Handle(evt))
                {
                    return(true);
                }
            }

            ResizeEvent resizeEvent = evt as ResizeEvent;

            if (resizeEvent != null)
            {
                OnResize(resizeEvent.Width, resizeEvent.Height);
            }

            return(false);
        }
Exemple #10
0
        /// <summary>
        /// Draw the day/hour grid and hour labels for the frame of the calendar
        /// </summary>
        /// <param name="pe">PaintEventArgs for drawing graphics on the control</param>
        public void DrawCalendarFrame(PaintEventArgs pe)
        {
            int width  = this.ClientRectangle.Width - leftMargin - rightMargin;
            int height = 1920;
            int left   = this.ClientRectangle.Left + leftMargin;
            int top    = this.ClientRectangle.Top + topMargin;
            int right  = left + width;
            int bottom = top + height;

            // fire the resize event with the needed positions for the day dividers
            CalendarResizedEventArgs r = new CalendarResizedEventArgs
            {
                dayStartPositions = new int[] { left, left + width / 5, left + 2 * width / 5, left + 3 * width / 5, left + 4 * width / 5, right },
            };

            ResizeEvent?.Invoke(this, r);

            Pen pen = new Pen(Color.LightGray);

            // draw horizontal divider lines of calendar
            int startX;

            for (int i = 0; i < 48; i++)
            {
                if (i % 2 == 0)
                {
                    startX = 0;
                }
                else
                {
                    startX = leftMargin;
                }
                pe.Graphics.DrawLine(pen, new Point(startX, top + 40 * i), new Point(right, top + 40 * i));
            }

            pen.Color = Color.Black;

            // draw vertical divider lines of calendar
            pe.Graphics.DrawLine(pen, new Point(left, top), new Point(left, bottom));                      // left vertical border line
            pe.Graphics.DrawLine(pen, new Point(left + width / 5, top), new Point(left + width / 5, bottom));
            pe.Graphics.DrawLine(pen, new Point(left + 2 * width / 5, top), new Point(left + 2 * width / 5, bottom));
            pe.Graphics.DrawLine(pen, new Point(left + 3 * width / 5, top), new Point(left + 3 * width / 5, bottom));
            pe.Graphics.DrawLine(pen, new Point(left + 4 * width / 5, top), new Point(left + 4 * width / 5, bottom));
            pe.Graphics.DrawLine(pen, new Point(right, top), new Point(right, bottom));                    // right vertical border line

            // draw bottom border line
            pen.Width *= 2;
            pe.Graphics.DrawLine(pen, new Point(left, bottom), new Point(right, bottom));

            // finished with pen for drawing, so dispose
            pen.Dispose();

            // prepare to draw hour divider labels (using SolidBrush)
            System.Drawing.Font         drawFont   = new System.Drawing.Font("Segoe UI", 12);
            System.Drawing.SolidBrush   brush      = new System.Drawing.SolidBrush(System.Drawing.Color.Gray);
            System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat();

            // draw label for each hour
            for (int i = 0; i < 24; i++)
            {
                pe.Graphics.DrawString(GetHourLabel(i), drawFont, brush, 5, top + 80 * i, drawFormat);
            }

            // dispose of string drawing resources
            drawFont.Dispose();
            brush.Dispose();
            drawFormat.Dispose();
        }
Exemple #11
0
 public void NotifyResize(ResizeEvent e) => OnResize?.Invoke(this, e);
 private void HandleResizeEvent(ResizeEvent evt)
 {
     UpdateProjectionMatrix(evt.Width, evt.Height);
 }