コード例 #1
0
    //Bullet colitions
    private void OnTriggerEnter2D(Collider2D otherCollider)
    {
        LeftLine     myLeftLine   = otherCollider.gameObject.GetComponent <LeftLine>();     //get the sidelines
        RightLine    myRightLine  = otherCollider.gameObject.GetComponent <RightLine>();    //get the sidelines
        BottomLine   myBottomline = otherCollider.gameObject.GetComponent <BottomLine>();   //get the Bottomline
        PlayerScript myPlayer     = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player
        EnemyScript  myEnemy      = otherCollider.gameObject.GetComponent <EnemyScript>();  //get the STD


        //if the collliding object is any sideline
        //if the collliding object is any sideline
        if (myRightLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x > 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        if (myLeftLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x < 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        else if (myBottomline != null)
        {
            transform.position = PointOutSideScreen;                     //bullet disappears
            MoveStdBullet      = false;                                  //StopBulletMovement

            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;
        }
        else if (myPlayer != null)
        {
            MoveStdBullet      = false;              //StopBulletMovement
            transform.position = PointOutSideScreen; //bullet disappears

            //do stuff
            myPlayer.transform.localScale = new Vector2(PlayerScript.PlayerObjectSize.x / 2f, PlayerScript.PlayerObjectSize.y / 2f); //reduce player size by 50%
            PlayerScript.SharpCondomsPlayerSizeCounter = 1;                                                                          //initiate the playersize counter
            StdPongPlayScript.intCurrentPlayerScore   -= 3;                                                                          //reduce player points


            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;
        }
    }
コード例 #2
0
ファイル: Border.cs プロジェクト: anikolop/FastReport
        /// <summary>
        /// Draw the border using draw event arguments and specified bounding rectangle.
        /// </summary>
        /// <param name="e">Draw event arguments.</param>
        /// <param name="rect">Bounding rectangle.</param>
        /// <remarks>
        /// This method is for internal use only.
        /// </remarks>
        public void Draw(FRPaintEventArgs e, RectangleF rect)
        {
            IGraphics g = e.Graphics;

            rect.X      *= e.ScaleX;
            rect.Y      *= e.ScaleY;
            rect.Width  *= e.ScaleX;
            rect.Height *= e.ScaleY;

            if (Shadow)
            {
                //int d = (int)Math.Round(ShadowWidth * e.ScaleX);
                //Pen pen = e.Cache.GetPen(ShadowColor, d, DashStyle.Solid);
                //g.DrawLine(pen, rect.Right + d / 2, rect.Top + d, rect.Right + d / 2, rect.Bottom);
                //g.DrawLine(pen, rect.Left + d, rect.Bottom + d / 2, rect.Right + d, rect.Bottom + d / 2);

                float d     = ShadowWidth * e.ScaleX;
                Brush brush = e.Cache.GetBrush(ShadowColor);
                g.FillRectangle(brush, rect.Left + d, rect.Bottom, rect.Width, d);
                g.FillRectangle(brush, rect.Right, rect.Top + d, d, rect.Height);
            }

            if (Lines != BorderLines.None)
            {
                // draw full frame as a rectangle with solid line only. Non-solid lines
                // should be drawn separately to avoid overlapping effect
                if (Lines == BorderLines.All && LeftLine.Equals(TopLine) && LeftLine.Equals(RightLine) &&
                    LeftLine.Equals(BottomLine) && LeftLine.Style == LineStyle.Solid)
                {
                    Pen pen = e.Cache.GetPen(LeftLine.Color, (int)Math.Round(LeftLine.Width * e.ScaleX), LeftLine.DashStyle);
                    g.DrawRectangle(pen, rect.Left, rect.Top, rect.Width, rect.Height);
                }
                else
                {
                    if ((Lines & BorderLines.Left) != 0)
                    {
                        LeftLine.Draw(e, rect.Left, rect.Top, rect.Left, rect.Bottom,
                                      true, (Lines & BorderLines.Top) != 0, (Lines & BorderLines.Bottom) != 0);
                    }
                    if ((Lines & BorderLines.Right) != 0)
                    {
                        RightLine.Draw(e, rect.Right, rect.Top, rect.Right, rect.Bottom,
                                       false, (Lines & BorderLines.Top) != 0, (Lines & BorderLines.Bottom) != 0);
                    }
                    if ((Lines & BorderLines.Top) != 0)
                    {
                        TopLine.Draw(e, rect.Left, rect.Top, rect.Right, rect.Top,
                                     true, (Lines & BorderLines.Left) != 0, (Lines & BorderLines.Right) != 0);
                    }
                    if ((Lines & BorderLines.Bottom) != 0)
                    {
                        BottomLine.Draw(e, rect.Left, rect.Bottom, rect.Right, rect.Bottom,
                                        false, (Lines & BorderLines.Left) != 0, (Lines & BorderLines.Right) != 0);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Border.cs プロジェクト: anikolop/FastReport
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            Border b = obj as Border;

            return(b != null && Lines == b.Lines &&
                   LeftLine.Equals(b.LeftLine) && TopLine.Equals(b.TopLine) &&
                   RightLine.Equals(b.RightLine) && BottomLine.Equals(b.BottomLine) &&
                   Shadow == b.Shadow && ShadowColor == b.ShadowColor && ShadowWidth == b.ShadowWidth);
        }
コード例 #4
0
 new public string ToString()
 {
     return(String.Format("\nLeftPath: {0}\nRightPath: {1}\nLeftLine: {2}\nRightLine: {3}\nRefs: {4}",
                          (LeftPath?.ToString() ?? "null"),
                          (RightPath?.ToString() ?? "null"),
                          (LeftLine?.ToString() ?? "null"),
                          (RightLine?.ToString() ?? "null"),
                          Refs.ToString()));
 }
コード例 #5
0
ファイル: Border.cs プロジェクト: anikolop/FastReport
 /// <summary>
 /// Serializes the border.
 /// </summary>
 /// <param name="writer">Writer object.</param>
 /// <param name="prefix">Border property name.</param>
 /// <param name="c">Another Border to compare with.</param>
 /// <remarks>
 /// This method is for internal use only.
 /// </remarks>
 public void Serialize(FRWriter writer, string prefix, Border c)
 {
     if (Shadow != c.Shadow)
     {
         writer.WriteBool(prefix + ".Shadow", Shadow);
     }
     if (ShadowWidth != c.ShadowWidth)
     {
         writer.WriteFloat(prefix + ".ShadowWidth", ShadowWidth);
     }
     if (ShadowColor != c.ShadowColor)
     {
         writer.WriteValue(prefix + ".ShadowColor", ShadowColor);
     }
     if (!SimpleBorder)
     {
         if (Lines != c.Lines)
         {
             writer.WriteValue(prefix + ".Lines", Lines);
         }
         if (Lines != BorderLines.None || Color != Color.Black)
         {
             if (LeftLine.Equals(RightLine) && LeftLine.Equals(TopLine) && LeftLine.Equals(BottomLine) &&
                 c.LeftLine.Equals(c.RightLine) && c.LeftLine.Equals(c.TopLine) && c.LeftLine.Equals(c.BottomLine))
             {
                 LeftLine.Serialize(writer, prefix, c.LeftLine);
             }
             else
             {
                 LeftLine.Serialize(writer, prefix + ".LeftLine", c.LeftLine);
                 TopLine.Serialize(writer, prefix + ".TopLine", c.TopLine);
                 RightLine.Serialize(writer, prefix + ".RightLine", c.RightLine);
                 BottomLine.Serialize(writer, prefix + ".BottomLine", c.BottomLine);
             }
         }
     }
     else
     {
         LeftLine.Serialize(writer, prefix, c.LeftLine);
     }
 }
コード例 #6
0
        private int HitTestFrame(Point point)
        {
            int result = 0;

            if (TopLeftGrip.Contains(point))
            {
                result = WM.HTTOPLEFT;
            }
            else if (TopRightGrip.Contains(point))
            {
                result = WM.HTTOPRIGHT;
            }
            else if (BottomLeftGrip.Contains(point))
            {
                result = WM.HTBOTTOMLEFT;
            }
            else if (BottomRightGrip.Contains(point))
            {
                result = WM.HTBOTTOMRIGHT;
            }
            else if (TopLine.Contains(point) || TopGrip.Contains(point))
            {
                result = WM.HTTOP;
            }
            else if (LeftLine.Contains(point) || LeftGrip.Contains(point))
            {
                result = WM.HTLEFT;
            }
            else if (RightLine.Contains(point) || RightGrip.Contains(point))
            {
                result = WM.HTRIGHT;
            }
            else if (BottomLine.Contains(point) || (BottomGrip.Contains(point)))
            {
                result = WM.HTBOTTOM;
            }

            return(result);
        }
コード例 #7
0
ファイル: Border.cs プロジェクト: anikolop/FastReport
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     return(Lines.GetHashCode() ^ (Shadow.GetHashCode() + 16) ^ ShadowColor.GetHashCode() ^
            (ShadowWidth.GetHashCode() + 32) ^ (LeftLine.GetHashCode() << 1) ^ (TopLine.GetHashCode() << 2) ^
            (RightLine.GetHashCode() << 3) ^ (BottomLine.GetHashCode() << 4));
 }
コード例 #8
0
ファイル: Border.cs プロジェクト: anikolop/FastReport
 private bool ShouldSerializeLeftLine()
 {
     return(LeftLine.ShouldSerialize());
 }
コード例 #9
0
ファイル: STDBall.cs プロジェクト: Zabrain/STDPong_Reloaded
    //Ball colitions
    private void OnTriggerEnter2D(Collider2D otherCollider)
    {
        // Sidelines mySideline = otherCollider.gameObject.GetComponent<Sidelines>();//get the sidelines
        LeftLine     myLeftLine   = otherCollider.gameObject.GetComponent <LeftLine>();     //get the sidelines
        RightLine    myRightLine  = otherCollider.gameObject.GetComponent <RightLine>();    //get the sidelines
        TopLine      myTopLine    = otherCollider.gameObject.GetComponent <TopLine>();      //get the Topline
        BottomLine   myBottomline = otherCollider.gameObject.GetComponent <BottomLine>();   //get the Bottomline
        PlayerScript myPlayer     = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player
        EnemyScript  myEnemy      = otherCollider.gameObject.GetComponent <EnemyScript>();  //get the STD


        //if the collliding object is any sideline
        if (myRightLine != null)
        {
            MyAudioManager.BallBounce();

            if (STDBallVelocity.x > 0)
            {
                STDBallVelocity.x *= -1;
            }
            STDBallVelocity    = new Vector2(STDBallVelocity.x, STDBallVelocity.y);
            STDBallRB.velocity = STDBallVelocity;
            //STDBallSpeedX *= -1;
        }
        if (myLeftLine != null)
        {
            MyAudioManager.BallBounce();

            if (STDBallVelocity.x < 0)
            {
                STDBallVelocity.x *= -1;
            }
            STDBallVelocity    = new Vector2(STDBallVelocity.x, STDBallVelocity.y);
            STDBallRB.velocity = STDBallVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is topline
        else if (myTopLine != null)
        {
            MyAudioManager.BallBounce();

            if (STDBallVelocity.y > 0)
            {
                STDBallVelocity.y *= -1;
            }
            STDBallVelocity    = new Vector2(STDBallVelocity.x, STDBallVelocity.y);
            STDBallRB.velocity = STDBallVelocity;

            StdPongPlayScript.MyEnemyHealth -= .10f;       //reduce the enemy health

            StdPongPlayScript.intCurrentPlayerScore += 10; //increase player points
        }
        //if the collliding object is bottomline
        else if (myBottomline != null)
        {
            MyAudioManager.BallBounce();

            if (STDBallVelocity.y < 0)
            {
                STDBallVelocity.y *= -1;
            }
            STDBallVelocity    = new Vector2(STDBallVelocity.x, STDBallVelocity.y);
            STDBallRB.velocity = STDBallVelocity;


            StdPongPlayScript.MyPlayerHealth -= .05f;      //reduce the player health

            StdPongPlayScript.intCurrentPlayerScore -= 10; //reduce player points
        }
        else if (myPlayer != null)
        {
            MyAudioManager.BallBounce();

            int RandomDirection = Random.Range(1, 3);
            int RandomSlantX    = Random.Range(5, 8);
            int RandomSlantY    = Random.Range(6, 10);

            if (RandomDirection == 1)
            {
                STDBallVelocity = new Vector2(RandomSlantX * -1f, RandomSlantY * 1f);
            }
            else
            {
                STDBallVelocity = new Vector2(RandomSlantX * 1f, RandomSlantY * 1f);
            }

            STDBallRB.velocity = STDBallVelocity;
        }
        else if (myEnemy != null)
        {
            MyAudioManager.BallBounce();

            int RandomDirection = Random.Range(1, 3);
            int RandomSlantX    = Random.Range(5, 8);
            int RandomSlantY    = Random.Range(6, 10);

            if (RandomDirection == 1)
            {
                STDBallVelocity = new Vector2(RandomSlantX * -1f, RandomSlantY * -1f);
            }
            else
            {
                STDBallVelocity = new Vector2(RandomSlantX * 1f, RandomSlantY * -1f);
            }

            STDBallRB.velocity = STDBallVelocity;
        }
    }
コード例 #10
0
    //Bullet colitions
    private void OnTriggerEnter2D(Collider2D otherCollider)
    {
        LeftLine     myLeftLine   = otherCollider.gameObject.GetComponent <LeftLine>();     //get the sidelines
        RightLine    myRightLine  = otherCollider.gameObject.GetComponent <RightLine>();    //get the sidelines
        BottomLine   myBottomline = otherCollider.gameObject.GetComponent <BottomLine>();   //get the Bottomline
        PlayerScript myPlayer     = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player
        EnemyScript  myEnemy      = otherCollider.gameObject.GetComponent <EnemyScript>();  //get the STD


        //if the collliding object is any sideline
        //if the collliding object is any sideline
        if (myRightLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x > 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        if (myLeftLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x < 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        else if (myBottomline != null)
        {
            transform.position = PointOutSideScreen;                     //bullet disappears
            MovePowerUp        = false;                                  //StopBulletMovement

            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;
        }
        else if (myPlayer != null)
        {
            MovePowerUp        = false;              //StopBulletMovement
            transform.position = PointOutSideScreen; //bullet disappears

            //do stuff
            StdPongPlayScript.MyPlayerHealth        += 0.05f; //increace player immune by 5%
            StdPongPlayScript.intCurrentPlayerScore += 3;     //reduce player points


            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;


            PlayerPrefs.SetInt("PowerupCount", PlayerPrefs.GetInt("PowerupCount") + 1); //increase the overall count of powerups
        }
    }
コード例 #11
0
ファイル: Condom.cs プロジェクト: Zabrain/STDPong_Reloaded
    //Bullet colitions
    private void OnTriggerEnter2D(Collider2D otherCollider)
    {
        LeftLine     myLeftLine   = otherCollider.gameObject.GetComponent <LeftLine>();     //get the sidelines
        RightLine    myRightLine  = otherCollider.gameObject.GetComponent <RightLine>();    //get the sidelines
        BottomLine   myBottomline = otherCollider.gameObject.GetComponent <BottomLine>();   //get the Bottomline
        PlayerScript myPlayer     = otherCollider.gameObject.GetComponent <PlayerScript>(); //get the Player
        EnemyScript  myEnemy      = otherCollider.gameObject.GetComponent <EnemyScript>();  //get the STD


        //if the collliding object is any sideline
        //if the collliding object is any sideline
        if (myRightLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x > 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        if (myLeftLine != null)
        {
            MyAudioManager.BallBounce();

            if (MovingStuffVelocity.x < 0)
            {
                MovingStuffVelocity.x *= -1;
            }
            MovingStuffVelocity    = new Vector2(MovingStuffVelocity.x, MovingStuffVelocity.y);
            MovingStuffRB.velocity = MovingStuffVelocity;
            //STDBallSpeedX *= -1;
        }
        //if the collliding object is bottomline
        else if (myBottomline != null)
        {
            transform.position = PointOutSideScreen; //bullet disappears
            MovePowerUp        = false;              //StopBulletMovement


            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;
        }
        else if (myPlayer != null)
        {
            MovePowerUp                   = false;                                                                                   //StopBulletMovement
            transform.position            = PointOutSideScreen;                                                                      //bullet disappears
            myPlayer.transform.localScale = new Vector2(PlayerScript.PlayerObjectSize.x * 2f, PlayerScript.PlayerObjectSize.y * 2f); //increase player size by 100%
            PlayerScript.SharpCondomsPlayerSizeCounter = 1;                                                                          //initiate the playersize counter


            myBlinkerTextObject.transform.position = PointOutSideScreen; //transform condom blinking text
            MyBlinkerCounter = 0;
            //do stuff


            PlayerPrefs.SetInt("PowerupCount", PlayerPrefs.GetInt("PowerupCount") + 1); //increase the overall count of powerups
        }
    }