Beispiel #1
0
        public static void SendClassicFireball(int id)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext <DaggerHub>();

            PointObject temp = new PointObject(daggersrage.nextid);

            daggersrage.nextid++;

            PlayerObject result = (PlayerObject)daggersrage.playerArray.Find(x => x.id == id);

            if (result != null)
            {
                temp.currentstate.x_position = result.currentstate.x_position + result.playerInput.RECENTKEY * 16;
                temp.currentstate.y_position = result.currentstate.y_position;


                temp.currentstate.y_velocity = (150);
                temp.currentstate.x_velocity = result.playerInput.RECENTKEY * 200;

                //temp.currentstate.y_position += result.currentstate.y_velocity;

                daggersrage.pointArray.Add(temp);


                context.Clients.All.addProjectile(temp.id, temp.currentstate);
            }
        }
Beispiel #2
0
        public static void SendMouseAngle(float rad, int id, int num)
        {
            var context = GlobalHost.ConnectionManager.GetHubContext <DaggerHub>();

            if (num == 1)
            {
                PointObject temp = new PointObject(daggersrage.nextid);

                daggersrage.nextid++;

                PlayerObject result = (PlayerObject)daggersrage.playerArray.Find(x => x.id == id);

                if (result != null)
                {
                    temp.currentstate.x_position = result.currentstate.x_position;
                    temp.currentstate.y_position = result.currentstate.y_position;


                    temp.currentstate.y_velocity = (float)(300 * Math.Sin(rad));
                    temp.currentstate.x_velocity = (float)(300 * Math.Cos(rad));

                    temp.currentstate.y_position += result.currentstate.y_velocity;

                    /*
                     * if (temp.currentstate.y_velocity >= 0)
                     * {
                     *  temp.currentstate.y_position += 16;
                     *
                     * }
                     * else
                     * {
                     *
                     *  temp.currentstate.y_position -= 16;
                     * }
                     */

                    daggersrage.pointArray.Add(temp);


                    context.Clients.All.addProjectile(temp.id, temp.currentstate);
                }
            }
            else
            {
                PlayerObject result = (PlayerObject)daggersrage.playerArray.Find(x => x.id == id);

                if (result != null)
                {
                    vector2 temp = daggersrage.beamProjection(result.currentstate.x_position, result.currentstate.y_position, rad, 160);

                    vector2 tempend = new vector2(result.currentstate.x_position, result.currentstate.y_position);



                    context.Clients.All.addEffect(temp, tempend);
                }
            }
            //Debug.WriteLine("projectiles : " + daggersrage.pointArray.Count + "  latest : " + temp.id);
        }