コード例 #1
0
ファイル: HitRecord.cs プロジェクト: BeRo1985/LevelEditor
 /// <summary>
 /// Constructor for hitting a custom object in the timeline control</summary>
 /// <param name="type">Hit type</param>
 /// <param name="hitObject">Hit object. Should be the same object over multiple mouse
 /// move events so that tooltips don't flicker.</param>
 public HitRecord(HitType type, object hitObject)
 {
     Type = type;
     HitObject = hitObject;
     HitPath = null;
     HitTimelineObject = null;
 }
コード例 #2
0
ファイル: HitRecord.cs プロジェクト: BeRo1985/LevelEditor
 /// <summary>
 /// Constructor for a HitRecord representing a hit on an ITimelineObject. If this
 /// ITimelineObject is in the main document, then the path will have just one element
 /// in it. Otherwise, the elements of the path should be ITimelineReference objects
 /// plus some other ITimelineObject (like IInterval, for example) as the last element.</summary>
 /// <param name="type">Hit type</param>
 /// <param name="path">Full path of the hit timeline object</param>
 public HitRecord(HitType type, TimelinePath path)
 {
     Type = type;
     HitPath = path;
     HitTimelineObject = path != null ? path.Last : null;
     HitObject = HitTimelineObject;
 }
コード例 #3
0
ファイル: CBullet.cs プロジェクト: firerings/ski-proto-01
 public void SetBullet(Attribute attribute_, HitType hit_type_, float SPD_, float ATK_, State state_)
 {
     attribute = attribute_;
     hit_type = hit_type_;
     bullet_SPD = SPD_;
     ATK = ATK_;
     bullet_state = state_;
 }
コード例 #4
0
        private static void Track(HitType type, string category, string action, string label,
                                  int? value = null)
        {
            if (string.IsNullOrEmpty(category)) throw new ArgumentNullException("category");
            if (string.IsNullOrEmpty(action)) throw new ArgumentNullException("action");

            var request = (HttpWebRequest)WebRequest.Create("http://www.google-analytics.com/collect");
            request.Method = "POST";
            request.KeepAlive = false;

            // the request body we want to send
            var postData = new Dictionary<string, string>
                           {
                               { "v", "1" },
                               { "tid", "UA-67700554-1" },
                               { "cid", "555" },
                               { "t", type.ToString() },
                               { "ec", category },
                               { "ea", action },
                           };
            if (!string.IsNullOrEmpty(label))
            {
                postData.Add("el", label);
            }
            if (value.HasValue)
            {
                postData.Add("ev", value.ToString());
            }

            var postDataString = postData
                .Aggregate("", (data, next) => string.Format("{0}&{1}={2}", data, next.Key,
                                                             HttpUtility.UrlEncode(next.Value)))
                .TrimEnd('&');

            // set the Content-Length header to the correct value
            request.ContentLength = Encoding.UTF8.GetByteCount(postDataString);

            // write the request body to the request
            using (var writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(postDataString);
            }

            try
            {
                var webResponse = (HttpWebResponse)request.GetResponse();
                if (webResponse.StatusCode != HttpStatusCode.OK)
                {
                    throw new HttpException((int)webResponse.StatusCode,
                                            "Google Analytics tracking did not return OK 200");
                }
                webResponse.Close();
            }
            catch (Exception)
            {
            }
        }
コード例 #5
0
ファイル: TrackService.cs プロジェクト: jieverson/PixelRoad
        private static String GeneratePayloadData(HitType hitType, String pageName = null, String screenName = null, String category = null, String action = null, String label = null, uint? value = null, SessionControl sessionControl = SessionControl.None)
        {
            if (String.IsNullOrEmpty(TrackConfig.TrackingID))
                throw new ArgumentException("TrackingID can not be empty.");
            if (String.IsNullOrEmpty(TrackConfig.ClientID))
                throw new ArgumentException("ClientID can not be empty.");

            String v = PROTOCOL_VERSION;
            String tid = TrackConfig.TrackingID;
            String cid = TrackConfig.ClientID;
            String t = hitType.ToString().ToLower();
            String sr =
                TrackConfig.ScreenWidth != null
                && TrackConfig.ScreenHeight != null
                ? TrackConfig.ScreenWidth + "x" + TrackConfig.ScreenHeight
                : null;
            String dp = pageName;
            String cd = screenName;
            String ec = category;
            String ea = action;
            String el = label;
            String ev = value != null ? value.ToString() : null;
            String sc = sessionControl != SessionControl.None ? sessionControl.ToString().ToLower() : null;
            String uid = TrackConfig.UserID;
            String an = TrackConfig.ApplicationName;
            String aid = TrackConfig.ApplicationID;
            String av = TrackConfig.ApplicationVersion;

            var payload_data = new StringBuilder();

            // Required Information
            payload_data.Append("v=" + v);
            payload_data.Append("&tid=" + tid);
            payload_data.Append("&cid=" + cid);
            payload_data.Append("&t=" + t);

            // Tracking Information
            if (dp != null) payload_data.Append("&dp=" + dp);
            if (cd != null) payload_data.Append("&cd=" + cd);
            if (ec != null) payload_data.Append("&ec=" + ec);
            if (ea != null) payload_data.Append("&ea=" + ea);
            if (el != null) payload_data.Append("&el=" + el);
            if (ev != null) payload_data.Append("&ev=" + ev);

            // Session Information
            if (sc != null) payload_data.Append("&sc=" + sc);

            // Opitional Information
            if (uid != null) payload_data.Append("&uid=" + uid);
            if (sr != null) payload_data.Append("&sr=" + sr);
            if (an != null) payload_data.Append("&an=" + an);
            if (aid != null) payload_data.Append("&aid=" + aid);
            //if (av != null) payload_data.Append("&av=" + av);

            return payload_data.ToString();
        }
コード例 #6
0
ファイル: CShooter.cs プロジェクト: firerings/ski-proto-01
 public void SetBulletInfo(int num_, Attribute attribute_, HitType hit_type_, float SPD_, float ATK_, State state_, float size_)
 {
     bullet_num = num_;
     attribute = attribute_;
     hit_type = hit_type_;
     bullet_SPD = SPD_;
     bullet_ATK = ATK_;
     bullet_state = state_;
     bullet_size = size_;
 }
コード例 #7
0
 /// <summary>
 /// 播放指定图片动画
 /// </summary>
 /// <param name="ht"></param>
 public void Play(HitType ht)
 {
     sbLevel.Stop();
     if (ht == HitType.Nice)
     {
         image.Source = good;
     }
     else if (ht == HitType.Normal)
     {
         image.Source = normal;
     }
     else
     {
         image.Source = bad;
     }
     sbLevel.Begin();
 }
コード例 #8
0
ファイル: CharacterObject.cs プロジェクト: JeffM2501/CSC370
    public void Hit(HitType hitType)
    {
        if (InHit || Dying)
            return;

        if (HitPlane != null)
        {
            HitPlane.SetActive(true);

            BaseMaterial = HitMesh.renderer.materials[0];

            switch (hitType)
            {
                case HitType.Divine:
                    if (DivineSpellGraphic != null)
                        HitMesh.renderer.material = DivineSpellGraphic;
                    break;

                case HitType.Physical:
                    if (DamageGraphoc != null)
                        HitMesh.renderer.material = DamageGraphoc;
                    break;

                case HitType.Fire:
                    if (FireSpellGraphic != null)
                        HitMesh.renderer.material = FireSpellGraphic;
                    break;

                case HitType.Ice:
                    if (IceSpellGraphic != null)
                        HitMesh.renderer.material = IceSpellGraphic;
                    break;

                case HitType.GenericSpell:
                    if (GenericSpellGrpahic != null)
                        HitMesh.renderer.material = GenericSpellGrpahic;
                    break;
            }
        }

          //  OrigonalColor = Billboard.renderer.materials[0].color;
          //  Billboard.renderer.materials[0].color = HitFlashColor;
        InHit = true;
        LastHitStart = Time.time;
    }
コード例 #9
0
 /// <summary>
 /// Handles the projectile colliding with something
 /// </summary>
 /// <param name="other">the other collider</param>
 protected virtual void OnTriggerEnter2D(Collider2D other)
 {
     if (!Paused)
     {
         // Checks for if enemy
         if (other.gameObject.tag == targetTag)
         {
             bool targetLived = other.gameObject.GetComponent<DamagableObjectScript>().Damage(damage);
             if (damageHandler != null)
             { damageHandler(targetLived); }
             hit = HitType.Target;
         }
         else if (other.gameObject.layer == Constants.GROUND_LAYER)
         { hit = HitType.Ground; }
         else if (other.gameObject.tag == Constants.ATTACK_TAG && other.gameObject.GetComponent<DamagingObjectScript>().targetTag != targetTag)
         { hit = HitType.TargetAttack; }
         else
         { hit = HitType.None; }
     }
 }
コード例 #10
0
    public Effect(ActionComponent actionComponent, Character _sourceUnit, Character _targetUnit)
    {
        hitType = actionComponent.hitType;
        elementalType = actionComponent.elementalType;
        effectType = actionComponent.effectType;
        basePower = actionComponent.basePower;
        baseToHit = actionComponent.baseToHit;
        duration = actionComponent.duration;

        priPowerStat = actionComponent.priPowerStat;
        priPowerWeight = actionComponent.priPowerWeight;
        secPowerStat = actionComponent.secPowerStat;
        secPowerWeight = actionComponent.secPowerWeight;

        priResistStat = actionComponent.priResistStat;
        priResistWeight = actionComponent.priResistWeight;
        secResistStat = actionComponent.secResistStat;
        secResistWeight = actionComponent.secResistWeight;

        sourceUnit = _sourceUnit;
        targetUnit = _targetUnit;

        sourcePowerStat = GetStatPower(_sourceUnit);
    }
コード例 #11
0
 private void OnTriggerExit2D(Collider2D collision)//detectingTrigger관련
 {
     ballRgb2D             = collision.gameObject.GetComponent <Rigidbody2D>();
     ballRgb2D.isKinematic = false;
     hitType = HitType.BASIC;
 }
コード例 #12
0
 public override bool OnPressed(TaikoAction action)
 {
     JudgementType = action == TaikoAction.LeftRim || action == TaikoAction.RightRim ? HitType.Rim : HitType.Centre;
     return(UpdateResult(true));
 }
コード例 #13
0
    float CalculateCombo(HitType hitType, int combo)
    {
        float percentage = 5 * Mathf.Clamp(combo - 1, 0, int.MaxValue);

        return((_scoreByHitType[hitType] * percentage) / 100);
    }
コード例 #14
0
        private void Track(HitType type, string category, string action, string label,
			int? value = null)
        {
            Task.Run(() =>
            {
                try
                {
                    if (string.IsNullOrEmpty(category)) return;
                    if (string.IsNullOrEmpty(action)) return;

                    var request = (HttpWebRequest) WebRequest.Create("http://www.google-analytics.com/collect");
                    request.Method = "POST";
                    request.KeepAlive = false;
                    request.Timeout = 1000;

                    // the request body we want to send
                    var postData = new Dictionary<string, string>
                    {
                        {"v", "1"},
                        {"tid", _trackingId},
                        {"cid", _userGuid},
                        {"uid", _userGuid},
                        {"t", type.ToString()},
                        {"ec", category},
                        {"ea", action},
                        {"an", _applicationName},
                        {"aid", _applicationId},
                        {"av", _applicationVersion},
                    };
                    if (!string.IsNullOrEmpty(label))
                    {
                        postData.Add("el", label);
                    }
                    if (value.HasValue)
                    {
                        postData.Add("ev", value.ToString());
                    }

                    var postDataString = postData
                        .Aggregate("", (data, next) => string.Format("{0}&{1}={2}", data, next.Key,
                            HttpUtility.UrlEncode(next.Value)))
                        .TrimEnd('&');

                    // set the Content-Length header to the correct value
                    request.ContentLength = Encoding.UTF8.GetByteCount(postDataString);

                    // write the request body to the request
                    using (var writer = new StreamWriter(request.GetRequestStream()))
                    {
                        writer.Write(postDataString);
                    }

                    using (var webResponse = (HttpWebResponse) request.GetResponse())
                    {
                        if (webResponse.StatusCode != HttpStatusCode.OK)
                        {
                            Debug.Log("Google Analytics tracking did not return OK 200");
                        }
                        webResponse.Close();
                    }

                }
                catch (Exception e)
                {
                    Debug.Log(e.Message);
                }
            });
        }
コード例 #15
0
        private void _createExplotion(bool isFriend)
        {
            _listBombCritical = new List <bool>();
            _listExplosion    = new List <ParticleSystem>();
            _listMiss         = new List <ParticleSystem>();
            FleetType key = (!isFriend) ? FleetType.Enemy : FleetType.Friend;

            if (isFriend)
            {
                Dictionary <int, UIBattleShip> fBattleship = _fBattleship;
            }
            else
            {
                Dictionary <int, UIBattleShip> eBattleship = _eBattleship;
            }
            Dictionary <int, UIBattleShip> dictionary = (!isFriend) ? _fBattleship : _eBattleship;
            Vector3 position3 = default(Vector3);

            for (int i = 0; i < _dicBakuraiModel[key].Length; i++)
            {
                if (_dicBakuraiModel[key][i] == null || !_dicBakuraiModel[key][i].IsBakugeki())
                {
                    continue;
                }
                ShipModel_Battle defender = _dicBakuraiModel[key][i].Defender;
                int       num             = (!_dicBakuraiModel[key][i].GetProtectEffect()) ? defender.Index : defender.Index;
                bool      flag            = (_dicBakuraiModel[key][i].GetHitState() == BattleHitStatus.Miss) ? true : false;
                FleetType fleetType       = isFriend ? FleetType.Enemy : FleetType.Friend;
                _dicHitType[fleetType][num] = setHitType(fleetType, num, flag, HitType.Bomb);
                HitType hitType = (!isFriend) ? _dicHitType[FleetType.Friend][num] : _dicHitType[FleetType.Enemy][num];
                if (!flag)
                {
                    if (hitType == HitType.Bomb)
                    {
                        Vector3 position  = dictionary[num].transform.position;
                        float   x         = position.x;
                        Vector3 position2 = dictionary[num].transform.position;
                        position3 = new Vector3(x, 3f, position2.z);
                        ParticleSystem val = (!((UnityEngine.Object)BattleTaskManager.GetParticleFile().explosionAerial == null)) ? UnityEngine.Object.Instantiate <ParticleSystem>(BattleTaskManager.GetParticleFile().explosionAerial) : BattleTaskManager.GetParticleFile().explosionAerial;
                        ((Component)val).SetActive(isActive: true);
                        ((Component)val).transform.parent   = BattleTaskManager.GetBattleField().transform;
                        ((Component)val).transform.position = position3;
                        _listExplosion.Add(val);
                        _listBombCritical.Add((_dicBakuraiModel[key][i].GetHitState() == BattleHitStatus.Clitical) ? true : false);
                    }
                }
                else if (hitType == HitType.Miss)
                {
                    Vector3 position4 = dictionary[num].transform.position;
                    float   fMin      = position4.x - 0.5f;
                    Vector3 position5 = dictionary[num].transform.position;
                    float   fLim      = XorRandom.GetFLim(fMin, position5.x + 0.5f);
                    Vector3 position6 = dictionary[num].transform.position;
                    float   fMin2     = position6.z - 1f;
                    Vector3 position7 = dictionary[num].transform.position;
                    float   fLim2     = XorRandom.GetFLim(fMin2, position7.z + 1f);
                    float   num2      = fLim;
                    Vector3 position8 = dictionary[num].transform.position;
                    fLim = ((!(num2 >= position8.x)) ? (fLim - 0.5f) : (fLim + 0.5f));
                    float   num3      = fLim2;
                    Vector3 position9 = dictionary[num].transform.position;
                    fLim2 = ((!(num3 >= position9.z)) ? (fLim2 - 0.5f) : (fLim2 + 0.5f));
                    ParticleSystem val2 = (!((UnityEngine.Object)BattleTaskManager.GetParticleFile().splashMiss == null)) ? UnityEngine.Object.Instantiate <ParticleSystem>(BattleTaskManager.GetParticleFile().splashMiss) : BattleTaskManager.GetParticleFile().splashMiss;
                    ((Component)val2).SetActive(isActive: true);
                    ((Component)val2).transform.parent   = BattleTaskManager.GetBattleField().transform;
                    ((Component)val2).transform.position = new Vector3(fLim, 0f, fLim2);
                    _listMiss.Add(val2);
                }
            }
        }
コード例 #16
0
ファイル: BaseDirection.cs プロジェクト: birdofhappyday/SFUW
 public virtual void Hit(Vector3 hitPoint, float damage, HitType hittype = HitType.NONE, bool isWeakPoint = false)
 {
 }
コード例 #17
0
        //draw rectangle
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            Point hitTest = e.GetPosition(canvas);
            HitTestResult result = VisualTreeHelper.HitTest(canvas, hitTest);
            // buong chuot
            if (e.LeftButton == MouseButtonState.Released || rect == null)
            {
                if (result.VisualHit is Rectangle)
                {
                    var rectangle = result.VisualHit as Rectangle;
                    RectOnMouseMove(rectangle);
                    return;
                }
                MouseHitType = HitType.None;
                SetMouseCursor();
                return;
            }

            if (e.LeftButton == MouseButtonState.Pressed && result.VisualHit is Rectangle)
            {
                var rectangle = result.VisualHit as Rectangle;
                RectOnMouseMove(rectangle);
            }
            else
            {
                //nhan chuot
                var pos = e.GetPosition(canvas);

                var x = Math.Min(pos.X, startPoint.X);
                var y = Math.Min(pos.Y, startPoint.Y);

                var w = Math.Max(pos.X, startPoint.X) - x;
                var h = Math.Max(pos.Y, startPoint.Y) - y;

                rect.Width = w;
                rect.Height = h;

                Canvas.SetLeft(rect, x);
                Canvas.SetTop(rect, y);
            }
        }
コード例 #18
0
    // Update is called once per frame
    void Update()
    {
        if (isHitting)
        {
            return;
        }
        if (Input.GetMouseButton(0) && SystemInfo.deviceType == DeviceType.Desktop)
        {
            //print("Left click!");
            hitType = new HitType(HitType.TopDownHit, Strength);
            anim.SetTrigger("TopDownAttack");

            //hitType = new HitType(HitType.LeftSideHit, Strength);
            //anim.SetTrigger("LeftSideAttack");

            //hitType = new HitType(HitType.FrontalHit, Strength);
            //anim.SetTrigger("FrontalAttack");

            //hitType = new HitType(HitType.RightSideHit, Strength);
            //anim.SetTrigger("RightSideAttack");
        }
        foreach (Touch touch in Input.touches)
        {
            if (touch.phase == TouchPhase.Began)
            {
                fingerStart = touch.position;
                fingerEnd   = touch.position;
            }
            if (touch.phase == TouchPhase.Moved)
            {
                fingerEnd = touch.position;

                if ((fingerStart.x - fingerEnd.x) > 80) // right to left Swipe
                {
                    print("right to left swipe");
                    hitType = new HitType(HitType.RightSideHit, Strength);
                    anim.SetTrigger("RightSideAttack");
                }
                else if ((fingerStart.x - fingerEnd.x) < -80) // left to right Swipe
                {
                    print("left to right swipe");
                    hitType = new HitType(HitType.LeftSideHit, Strength);
                    anim.SetTrigger("LeftSideAttack");
                    //anim.SetTrigger("FrontalAttack");
                }
                else if ((fingerStart.y - fingerEnd.y) < -80) // bottom to top swipe
                {
                    print("Top to bottom swipe");
                    hitType = new HitType(HitType.FrontalHit, Strength);
                    anim.SetTrigger("FrontalAttack");
                }
                else if ((fingerStart.y - fingerEnd.y) > 80) // top to bottom swipe
                {
                    print("Bottom to up swippe");
                    hitType = new HitType(HitType.TopDownHit, Strength);
                    anim.SetTrigger("TopDownAttack");
                }

                //After the checks are performed, set the fingerStart & fingerEnd to be the same
                fingerStart = touch.position;
            }
            if (touch.phase == TouchPhase.Ended)
            {
                fingerStart = Vector2.zero;
                fingerEnd   = Vector2.zero;
            }
        }
    }
コード例 #19
0
    /// <summary>
    /// Used to calculate what the tongue should be interacting with
    /// </summary>
    private void TongueLash()
    {
        // Used to calculate the Capsule for the CapsuleCast
        Vector3 pointModifier = new Vector3(0, (playerHeight / 2) + tongueFireRadius, 0);

        // Casts sphereCast. hit = The object that the circleCast hits if it hits something
        if (Physics.CapsuleCast(transform.position + pointModifier, // First point in capsule
                                transform.position - pointModifier, // Second point in capsule
                                tongueFireRadius,                   // Radius of Capsule
                                transform.forward,                  // Direction
                                out RaycastHit hit,                 // Output
                                300f))                              // Distance (If map gets really big then this number might need to be increased)
        {
            // Set defaults
            currentGrappleTime = 0f;
            // Reset player state and tongue hit
            DisconnectTongue();
            // Remove any existing points in tongue
            tongueHitPoints.Clear();
            // Set the first position to zero because it's calculated in update
            tongueHitPoints.Add(Vector3.zero);
            // Set where the tongue has hit
            tongueHitPoints.Add(StandardisePosition(hit.point));
            // Set what it hit.
            objectHit = hit.collider.gameObject;

            // If the tongue has hit a wall or other environment
            if ((environmentLayer.value & (1 << objectHit.layer)) != 0)
            {
                tongueHit = HitType.ENVIRONMENT;
                // Set cooldown
                currentCooldown = tongueCooldown;
            }
            // If the tongue has hit a collectable
            else if ((collectableLayer.value & (1 << objectHit.layer)) != 0)
            {
                // Get the script from the collectable
                CollectableController collectable = objectHit.GetComponent <CollectableController>();
                // If the collectable is a stack then grab only one
                if (collectable.stackSize > 1)
                {
                    collectable.stackSize--;
                    objectHit = Instantiate(collectablePrefab,
                                            objectHit.transform.position,
                                            objectHit.transform.rotation);
                }
                tongueHit = HitType.COLLECTABLE;
                // Freeze the rotation of the collectable to make pulling more smooth
                objectHit.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
            }
            // If you hit another player
            else if (objectHit.tag == "Player")
            {
                PlayerControllerXbox player = objectHit.GetComponent <PlayerControllerXbox>();
                // If the player has something to steal
                if (player.heldCollectables > 0)
                {
                    // Remove one from how many they are holding
                    player.heldCollectables--;
                    // Create new collectable at position of player
                    objectHit = Instantiate(collectablePrefab,
                                            objectHit.transform.position,
                                            objectHit.transform.rotation);

                    tongueHit = HitType.COLLECTABLE;
                    // Vibrate their controller
                    player.StartCoroutine(Vibrate());
                    // Play sound for when collectable is stolen
                    player.PlayStolenSound();
                }
            }
            // If the tongue is attached to something then activate it
            line.enabled = tongueHit != HitType.NONE;
        }
    }
コード例 #20
0
        // If a drag is in progress, continue the drag.
        // Otherwise display the correct cursor.
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            if (!DragInProgress)
            {
                Point po = Mouse.GetPosition(_MainWindow.canvas_vanet);
                MouseHitType = SetHitType(po);
                SetMouseCursor();
            }
            else
            {
                // See how much the mouse has moved.
                Point  point    = Mouse.GetPosition(_MainWindow.canvas_vanet);
                double offset_x = point.X - LastPoint.X;
                double offset_y = point.Y - LastPoint.Y;

                // Get the rectangle's current position.
                double new_x      = this.Margin.Left;
                double new_y      = this.Margin.Top;
                double new_width  = this.Width;
                double new_height = this.Height;

                // Update the rectangle.
                switch (MouseHitType)
                {
                case HitType.Body:
                    new_x += offset_x;
                    new_y += offset_y;
                    break;

                case HitType.UL:
                    new_x      += offset_x;
                    new_y      += offset_y;
                    new_width  -= offset_x;
                    new_height -= offset_y;
                    break;

                case HitType.UR:
                    new_y      += offset_y;
                    new_width  += offset_x;
                    new_height -= offset_y;
                    break;

                case HitType.LR:
                    new_width  += offset_x;
                    new_height += offset_y;
                    break;

                case HitType.LL:
                    new_x      += offset_x;
                    new_width  -= offset_x;
                    new_height += offset_y;
                    break;

                case HitType.L:
                    new_x     += offset_x;
                    new_width -= offset_x;
                    break;

                case HitType.R:
                    new_width += offset_x;
                    break;

                case HitType.B:
                    new_height += offset_y;
                    break;

                case HitType.T:
                    new_y      += offset_y;
                    new_height -= offset_y;
                    break;
                }

                // Don't use negative width or height.
                if ((new_width > 0) && (new_height > 0))
                {
                    // Update the rectangle.
                    Position    = new Point(new_x, new_y);
                    this.Width  = new_width;
                    this.Height = new_height;
                    // Save the mouse's new location.
                    LastPoint = point;
                }
            }
        }
コード例 #21
0
        private void HandleDrag(HitType mouseHitType, DragDeltaEventArgs args)
        {
            if (!(AdornedElement is FrameworkElement fel))
            {
                return;
            }

            var offsetX = (int)args.HorizontalChange;
            var offsetY = (int)args.VerticalChange;

            var har = fel.HorizontalAlignment == HorizontalAlignment.Right;
            var vab = fel.VerticalAlignment == VerticalAlignment.Bottom;

            var newX      = (int)(har ? fel.Margin.Right : fel.Margin.Left);
            var newY      = (int)(vab ? fel.Margin.Bottom : fel.Margin.Top);
            var newWidth  = (int)fel.ActualWidth;
            var newHeight = (int)fel.ActualHeight;

            void ModifyX(bool positive)
            {
                if (positive)
                {
                    newX += offsetX;
                }
                else
                {
                    newX -= offsetX;
                }
            }

            void ModifyY(bool positive)
            {
                if (positive)
                {
                    newY += offsetY;
                }
                else
                {
                    newY -= offsetY;
                }
            }

            void ModifyWidth(bool positive)
            {
                if (positive)
                {
                    newWidth += offsetX;
                }
                else
                {
                    newWidth -= offsetX;
                }
            }

            void ModifyHeight(bool positive)
            {
                if (positive)
                {
                    newHeight += offsetY;
                }
                else
                {
                    newHeight -= offsetY;
                }
            }

            switch (mouseHitType)
            {
            case HitType.Body:
                ModifyX(!har);
                ModifyY(!vab);
                break;

            case HitType.UpperLeft:
                if (har)
                {
                    ModifyWidth(false);
                }
                else
                {
                    ModifyX(true);
                    ModifyWidth(false);
                }

                if (vab)
                {
                    ModifyHeight(false);
                }
                else
                {
                    ModifyY(true);
                    ModifyHeight(false);
                }
                break;

            case HitType.UpperRight:
                if (har)
                {
                    ModifyX(false);
                    ModifyWidth(true);
                }
                else
                {
                    ModifyWidth(true);
                }

                if (vab)
                {
                    ModifyHeight(false);
                }
                else
                {
                    ModifyY(true);
                    ModifyHeight(false);
                }
                break;

            case HitType.LowerRight:
                if (har)
                {
                    ModifyX(false);
                    ModifyWidth(true);
                }
                else
                {
                    ModifyWidth(true);
                }

                if (vab)
                {
                    ModifyY(false);
                    ModifyHeight(true);
                }
                else
                {
                    ModifyHeight(true);
                }
                break;

            case HitType.LowerLeft:
                if (har)
                {
                    ModifyWidth(false);
                }
                else
                {
                    ModifyX(true);
                    ModifyWidth(false);
                }

                if (vab)
                {
                    ModifyY(false);
                    ModifyHeight(true);
                }
                else
                {
                    ModifyHeight(true);
                }
                break;

            case HitType.Left:
                if (har)
                {
                    ModifyWidth(false);
                }
                else
                {
                    ModifyX(true);
                    ModifyWidth(false);
                }
                break;

            case HitType.Right:
                if (har)
                {
                    ModifyX(false);
                    ModifyWidth(true);
                }
                else
                {
                    ModifyWidth(true);
                }
                break;

            case HitType.Bottom:
                if (vab)
                {
                    ModifyY(false);
                    ModifyHeight(true);
                }
                else
                {
                    ModifyHeight(true);
                }
                break;

            case HitType.Top:
                if (vab)
                {
                    ModifyHeight(false);
                }
                else
                {
                    ModifyY(true);
                    ModifyHeight(false);
                }
                break;
            }

            if (newWidth > 0 && newHeight > 0)
            {
                if (newX < 0)
                {
                    newX = 0;
                }

                if (newY < 0)
                {
                    newY = 0;
                }

                double left = 0, top = 0, right = 0, bottom = 0;

                if (har)
                {
                    right = newX;
                }
                else
                {
                    left = newX;
                }

                if (vab)
                {
                    bottom = newY;
                }
                else
                {
                    top = newY;
                }

                fel.Margin = new Thickness(left, top, right, bottom);

                PositionUpdated?.Invoke(new Rect(newX, newY, newWidth, newHeight));

                if (mouseHitType != HitType.Body)
                {
                    fel.Width  = newWidth;
                    fel.Height = newHeight;
                }
            }
        }
コード例 #22
0
ファイル: GlobalModel.cs プロジェクト: Kreyl/nute
 /*
 public void SendSetLockList(IArmletInfo armlet, byte[] lockList)
 {
     SendPayload(armlet, CreatePayload(MessageId.MSG_UPDATE_LOCK_LIST, lockList));
 }
 */
 public void SendRoomHit(byte roomId, byte hitChance , HitType hitType)
 {
     SendPayloadToAll(CreatePayload(MessageId.MSG_ROOM_HIT, new[] {roomId, hitChance, (byte) hitType}));
 }
コード例 #23
0
ファイル: HitEventArgs.cs プロジェクト: TagsRocks/skill
 /// <summary>
 /// Create a CollisionHitInfo
 /// </summary>
 /// <param name="owner"> The object that caused this hit </param>
 /// <param name="type"> Type of hit </param>
 /// <param name="other"> Other collider </param>
 public CollisionHitEventArgs(GameObject owner, HitType type, UnityEngine.Collider other)
     : base(owner, type, other)
 {
 }
コード例 #24
0
        public HitType LookForHits(Dictionary <Bone, BoneData> segments, int playerId)
        {
            DateTime cur     = DateTime.Now;
            HitType  allHits = HitType.None;

            // Zero out score if necessary
            if (!this.scores.ContainsKey(playerId))
            {
                this.scores.Add(playerId, 0);
            }

            foreach (var pair in segments)
            {
                for (int i = 0; i < this.things.Count; i++)
                {
                    HitType hit   = HitType.None;
                    Thing   thing = this.things[i];
                    switch (thing.State)
                    {
                    case ThingState.Bouncing:
                    case ThingState.Falling:
                    {
                        var     hitCenter       = new System.Windows.Point(0, 0);
                        double  lineHitLocation = 0;
                        Segment seg             = pair.Value.GetEstimatedSegment(cur);
                        if (thing.Hit(seg, ref hitCenter, ref lineHitLocation))
                        {
                            double fMs = 1000;
                            if (thing.TimeLastHit != DateTime.MinValue)
                            {
                                fMs = cur.Subtract(thing.TimeLastHit).TotalMilliseconds;
                                thing.AvgTimeBetweenHits = (thing.AvgTimeBetweenHits * 0.8) + (0.2 * fMs);
                            }

                            thing.TimeLastHit = cur;

                            // Bounce off head and hands
                            if (seg.IsCircle())
                            {
                                // Bounce off of hand/head/foot
                                thing.BounceOff(
                                    hitCenter.X,
                                    hitCenter.Y,
                                    seg.Radius,
                                    pair.Value.XVelocity / this.targetFrameRate,
                                    pair.Value.YVelocity / this.targetFrameRate);

                                if (fMs > 100.0)
                                {
                                    hit |= HitType.Hand;
                                }
                            }
                            else
                            {
                                // Bounce off line segment
                                double velocityX = (pair.Value.XVelocity * (1.0 - lineHitLocation)) + (pair.Value.XVelocity2 * lineHitLocation);
                                double velocityY = (pair.Value.YVelocity * (1.0 - lineHitLocation)) + (pair.Value.YVelocity2 * lineHitLocation);

                                thing.BounceOff(
                                    hitCenter.X,
                                    hitCenter.Y,
                                    seg.Radius,
                                    velocityX / this.targetFrameRate,
                                    velocityY / this.targetFrameRate);

                                if (fMs > 100.0)
                                {
                                    hit |= HitType.Arm;
                                }
                            }

                            /*if (this.gameMode == GameMode.TwoPlayer)
                             * {
                             *  if (thing.State == ThingState.Falling)
                             *  {
                             *      thing.State = ThingState.Bouncing;
                             *      thing.TouchedBy = playerId;
                             *      thing.Hotness = 1;
                             *      thing.FlashCount = 0;
                             *  }
                             *  else if (thing.State == ThingState.Bouncing)
                             *  {
                             *      if (thing.TouchedBy != playerId)
                             *      {
                             *          if (seg.IsCircle())
                             *          {
                             *              thing.TouchedBy = playerId;
                             *              thing.Hotness = Math.Min(thing.Hotness + 1, 4);
                             *          }
                             *          else
                             *          {
                             *              hit |= HitType.Popped;
                             *              this.AddToScore(thing.TouchedBy, 5 << (thing.Hotness - 1), thing.Center);
                             *          }
                             *      }
                             *  }
                             * }*/
                            if (this.gameMode == GameMode.Solo)
                            {
                                if (seg.IsCircle())
                                {
                                    if (thing.State == ThingState.Falling)
                                    {
                                        thing.State      = ThingState.Bouncing;
                                        thing.TouchedBy  = playerId;
                                        thing.Hotness    = 1;
                                        thing.FlashCount = 0;
                                    }
                                    else if ((thing.State == ThingState.Bouncing) && (fMs > 100.0))
                                    {
                                        hit |= HitType.Popped;
                                        int points = (pair.Key.Joint1 == JointType.FootLeft ||
                                                      pair.Key.Joint1 == JointType.FootRight)
                                                                 ? 10
                                                                 : 5;
                                        this.AddToScore(
                                            thing.TouchedBy,
                                            points,
                                            thing.Center);
                                        thing.TouchedBy = playerId;
                                    }
                                }
                            }

                            this.things[i] = thing;

                            if (thing.AvgTimeBetweenHits < 8)
                            {
                                hit |= HitType.Popped | HitType.Squeezed;
                                if (this.gameMode != GameMode.Off)
                                {
                                    this.AddToScore(playerId, 1, thing.Center);
                                }
                            }
                        }
                    }

                    break;
                    }

                    if ((hit & HitType.Popped) != 0)
                    {
                        thing.State     = ThingState.Dissolving;
                        thing.Dissolve  = 0;
                        thing.XVelocity = thing.YVelocity = 0;
                        thing.SpinRate  = (thing.SpinRate * 6) + 0.2;
                        this.things[i]  = thing;
                    }

                    allHits |= hit;
                }
            }

            return(allHits);
        }
コード例 #25
0
 private DrawableTestHit createHit(HitType type) => new DrawableTestHit(new Hit {
     StartTime = Time.Current, Type = type
 });
コード例 #26
0
    public ActionComponent(Dictionary<string,string> data)
    {
        /*
        foreach(KeyValuePair<string, string> e in data)
        {
            Debug.Log(e.Key.ToString() + " : " + e.Value.ToString());
        }
        */

        executionOrder = int.Parse(data["Component"]);
        targetType = (TargetType)System.Enum.Parse(typeof(TargetType), data["TargetType"].ToString());
        hitType = (HitType)System.Enum.Parse(typeof(HitType), data["HitType"].ToString());
        elementalType = (ElementalType)System.Enum.Parse(typeof(ElementalType), data["ElementalType"].ToString());
        effectType = (EffectType)System.Enum.Parse(typeof(EffectType), data["EffectType"].ToString());
        basePower = float.Parse(data["BasePower"]);
        baseToHit = float.Parse(data["BaseToHit"]);
        duration = int.Parse(data["Duration"]);

        string[] powerStats = data["PowerStats"].Split(char.Parse(","));
        priPowerStat = (StatType)System.Enum.Parse(typeof(StatType), powerStats[0].ToString());
        if(powerStats.Length > 1)
        {
            secPowerStat = (StatType)System.Enum.Parse(typeof(StatType), powerStats[1].ToString());
        }
        priPowerWeight = float.Parse(data["PrimaryPowerStatWeight"]);
        secPowerWeight = 1f - priPowerWeight;

        string[] resistStats = data["DefenseStats"].Split(char.Parse(","));
        priResistStat = (StatType)System.Enum.Parse(typeof(StatType), resistStats[0].ToString());
        if(resistStats.Length > 1)
        {
            secResistStat = (StatType)System.Enum.Parse(typeof(StatType), resistStats[1].ToString());
        }
        priResistWeight = float.Parse(data["PrimaryDefenseStatWeight"]);
        secResistWeight = 1f - priResistWeight;
    }
コード例 #27
0
ファイル: HexViewer.cs プロジェクト: mamingxiu/dnExplorer
			internal HitTestResult(HitType type, long index) {
				Type = type;
				Index = index;
			}
コード例 #28
0
ファイル: MarkupPanelHandler.cs プロジェクト: andrewgbuck/GPV
    private void FillWithColor()
    {
        int    groupId  = Convert.ToInt32(Request.Form["id"]);
        double x        = Convert.ToDouble(Request.Form["x"]);
        double y        = Convert.ToDouble(Request.Form["y"]);
        double distance = Convert.ToDouble(Request.Form["distance"]);
        double scale    = Convert.ToDouble(Request.Form["scale"]);

        string markupColor   = Request.Form["color"];
        string textGlowColor = Request.Form["glow"];

        Point p       = new Point(x, y);
        bool  updated = false;

        try
        {
            using (OleDbConnection connection = AppContext.GetDatabaseConnection())
            {
                string sql = String.Format("select MarkupID, Shape, Text, Measured from {0}Markup where GroupID = ?", AppSettings.ConfigurationTablePrefix);

                using (OleDbCommand command = new OleDbCommand(sql, connection))
                {
                    command.Parameters.Add("@1", OleDbType.Integer).Value = groupId;
                    DataTable table = new DataTable();

                    using (OleDbDataAdapter adapter = new OleDbDataAdapter(command))
                    {
                        adapter.Fill(table);
                    }

                    command.Parameters.Clear();

                    for (int i = table.Rows.Count - 1; i >= 0; --i)
                    {
                        DataRow row     = table.Rows[i];
                        HitType hitType = MarkupHitTest(row, p, distance, scale);

                        if (hitType != HitType.None)
                        {
                            command.CommandText = String.Format("update {0}Markup set Color = '{1}' where MarkupID = {2}", AppSettings.ConfigurationTablePrefix, markupColor, row["MarkupID"]);
                            command.ExecuteNonQuery();

                            if (hitType == HitType.Text || hitType == HitType.Coordinate)
                            {
                                string glow = textGlowColor == null ? "null" : String.Format("'{0}'", textGlowColor);
                                command.CommandText = String.Format("update {0}Markup set Glow = {1} where MarkupID = {2}", AppSettings.ConfigurationTablePrefix, glow, row["MarkupID"]);
                                command.ExecuteNonQuery();
                            }

                            UpdateMarkupGroupLastAccessed(groupId, connection);

                            updated = true;
                            break;
                        }
                    }
                }
            }
        }
        catch { }

        ReturnJson(updated);
    }
コード例 #29
0
		/// <summary>
		/// シーン内の指定された位置にあるものを検知
		/// bool MQCommandPlugin::HitTest(MQScene scene, POINT p, HIT_TEST_PARAM&amp; param)
		/// </summary>
		/// <param name="scene">シーン</param>
		/// <param name="p">位置</param>
		/// <param name="testType">種類</param>
		/// <returns>結果</returns>
		public unsafe HitTestResult HitTest(Scene scene, int[] p, HitType testType)
		{
			var rt = new HitTestResult();

			fixed (byte* sceneString = GetASCII("scene"),
						 xString = GetASCII("x"),
						 yString = GetASCII("y"),
						 testTypeString = GetASCII("test_type"),
						 hitTypeString = GetASCII("hit_type"),
						 hitPosString = GetASCII("hit_pos"),
						 hitObjectString = GetASCII("hit_object"),
						 hitVertexString = GetASCII("hit_vertex"),
						 hitLineString = GetASCII("hit_line"),
						 hitFaceString = GetASCII("hit_face"))
			fixed (int* point = p)
			{
				var array = new void*[]
				{
					sceneString,
					(void*)scene.Handle,
					xString,
					&point[0],
					yString,
					&point[1],
					testTypeString,
					&testType,
					hitTypeString,
					&rt.HitType,
					hitPosString,
					&rt.HitPos,
					hitObjectString,
					&rt.ObjectIndex,
					hitVertexString,
					&rt.VertexIndex,
					hitLineString,
					&rt.LineIndex,
					hitFaceString,
					&rt.FaceIndex,
					null,
				};

				fixed (void** arrayPtr = array)
					SendMessage(Message.HitTest, (IntPtr)arrayPtr);

				return rt;
			}
		}
コード例 #30
0
 public ControllerHitInfo GetCharacterControllerHitInfo(HitType type = HitType.Down)
 {
     return(new ControllerHitInfo(_motor.GroundingStatus.GroundNormal, _motor.GroundingStatus.GroundPoint, _motor.GroundingStatus.GroundCollider, 0f, null, _motor.GroundingStatus.IsOnGround));
 }
コード例 #31
0
    public bool SetData(int charIndex, int accountLevel, int level, int grade, int arrayIndexNum)
    {
        LevelData leveldata;
        CharacterData chardata;
        BulletData bulletdata;

        My_Level = level;//GameManager.charnum[arrayIndexNum] % 100;// (GetLevelDataIndex() / 100) % 100;
        My_Grade = grade;
        DataManager.Get().CharDatas.TryGetValue(index, out chardata);
        DataManager.Get().LevelDatas.TryGetValue(GetLevelDataIndex(), out leveldata);

        if (chardata == null)
        {
            Debug.Log("Char SetData in CharacterStatus Error : " + index);
        }
        if (leveldata == null)
        {
            Debug.Log("Level SetData in CharacterStatus Error : " + GetLevelDataIndex() );
        }
        DataManager.Get().BulletDatas.TryGetValue(GetLevelDataIndex() / 100, out bulletdata);
        if (bulletdata == null)
        {
            Debug.Log("BULLET SetData in CharacterStatus Error : " + chardata.BulletIndex);
        }

        num = arrayIndexNum;
        index = chardata.Index;
        charon = true;
        char_name = chardata.ResourceName + ((GetLevelDataIndex() / 100) % 100).ToString();
        char_hanname = chardata.Name;
        attribute = (Attribute)chardata.Attribute;
        char_MP = chardata.ManaPoint;
        char_HP = leveldata.HealthPoint * (1f + (accountLevel * 0.006f));
        char_ATK = leveldata.AttackPoint * (1f + (accountLevel * 0.003f)); 
        char_SPD = chardata.Speed;
        Askill_num = chardata.SkillIndex;
        Askill_name = chardata.SkillName;
        Askill_info = chardata.SkillDesc;
        Askill_MP = chardata.SkillManaCost;
        bullet_num = chardata.BulletIndex;

        bullet_move_type = (BulletMove)bulletdata.MoveType;
        bullet_hit_type = (HitType)bulletdata.HitType;
        bullet_SPD = bulletdata.Speed;
        bullet_size = bulletdata.Size;
        shooting_way = bulletdata.MuzzleCount;
        shooting_angle = bulletdata.MuzzleAngle;
        shooting_amount = bulletdata.Amount;
        shooting_repeat = bulletdata.Repeat;
        shooting_delay = bulletdata.Delay;
        shooting_period = bulletdata.Period;
        //Debug.Log(char_hanname + " : " + GetLevelDataIndex() + " >> " + leveldata.AttackPoint + " : " + char_ATK);
        return true;
    }
コード例 #32
0
ファイル: Projections.cs プロジェクト: Dekryptor/Port-1
        public static void EmulateDamage(Obj_AI_Base sender, Base.Champion hero, Gamedata data, HitType dmgType,
                                         string notes = null, float dmgEntry = 0f, int expiry = 500)
        {
            var hpred = new HPInstance();

            hpred.HitType    = dmgType;
            hpred.TargetHero = hero.Player;
            hpred.Data       = data;
            hpred.Name       = string.Empty;

            if (!string.IsNullOrEmpty(data?.SDataName))
            {
                hpred.Name = data.SDataName;
            }

            if (sender is AIHeroClient)
            {
                hpred.Attacker = sender;
            }

            if (dmgEntry == 0f && sender != null)
            {
                switch (dmgType)
                {
                case HitType.AutoAttack:
                    hpred.PredictedDmg = (float)sender.GetAutoAttackDamage(hero.Player, true);
                    break;

                case HitType.MinionAttack:
                case HitType.TurretAttack:
                    hpred.PredictedDmg =
                        (float)
                        Math.Max(
                            sender.CalcDamage(hero.Player, Damage.DamageType.Physical,
                                              sender.BaseAttackDamage + sender.FlatPhysicalDamageMod), 0);
                    break;

                default:
                    if (!string.IsNullOrEmpty(data?.SDataName))
                    {
                        hpred.PredictedDmg = (float)Math.Max(0, sender.GetSpellDamage(hero.Player, data.SDataName));
                    }
                    break;
                }
            }
            else
            {
                var idmg = dmgEntry;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }

            if (hpred.PredictedDmg > 0)
            {
                var idmg = hpred.PredictedDmg * Activator.Origin.Item("weightdmg").GetValue <Slider>().Value / 100;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }
            else
            {
                var idmg = (hero.Player.Health / hero.Player.MaxHealth) * 5;
                hpred.PredictedDmg = (float)Math.Round(idmg);
            }

            if (dmgType != HitType.Buff && dmgType != HitType.Troy)
            {
                // check duplicates (missiles and process spell)
                if (IncomeDamage.Select(entry => entry.Value).Any(o => o.Name == data.SDataName))
                {
                    return;
                }
            }

            var dmg             = AddDamage(hpred, hero, notes);
            var extendedEndtime = Activator.Origin.Item("lagtolerance").GetValue <Slider>().Value * 10;

            LeagueSharp.Common.Utility.DelayAction.Add(expiry + extendedEndtime, () => RemoveDamage(dmg, notes));
        }
コード例 #33
0
 public Hit(HitType hitType, Position position)
 {
     HitType  = hitType;
     Position = position;
 }
コード例 #34
0
        // If a drag is in progress, continue the drag.
        // Otherwise display the correct cursor.
        private void cropperMouseMove(object sender, MouseEventArgs e)
        {
            if (!DragInProgress)
            {
                MouseHitType = SetHitType(cropper, Mouse.GetPosition(cropperCanvas));
                SetMouseCursor();
            }
            else
            {
                // See how much the mouse has moved.
                Point  point    = Mouse.GetPosition(cropperCanvas);
                double offset_x = point.X - LastPoint.X;
                double offset_y = point.Y - LastPoint.Y;

                // Get the rectangle's current position.
                double new_x      = Canvas.GetLeft(cropper);
                double new_y      = Canvas.GetTop(cropper);
                double new_width  = cropper.Width;
                double new_height = cropper.Height;

                // Update the rectangle.
                switch (MouseHitType)
                {
                case HitType.Body:
                    new_x += offset_x;
                    new_y += offset_y;
                    break;

                case HitType.UL:
                    new_x     += offset_x;
                    new_width -= offset_x;
                    new_height = new_width * 9 / 16;
                    new_y     += offset_x * 9 / 16;
                    break;

                case HitType.UR:
                    new_y     -= offset_x * 9 / 16;
                    new_width += offset_x;
                    new_height = new_width * 9 / 16;
                    break;

                case HitType.LR:
                    new_width += offset_x;
                    new_height = new_width * 9 / 16;
                    break;

                case HitType.LL:
                    new_x      -= offset_y * 16 / 9;
                    new_height += offset_y;
                    new_width   = new_height * 16 / 9;
                    break;

                case HitType.L:
                    new_x     += offset_x;
                    new_width -= offset_x;
                    new_height = new_width * 9 / 16;
                    new_y     += (offset_x * 9 / 32);
                    break;

                case HitType.R:
                    new_width += offset_x;
                    new_height = new_width * 9 / 16;
                    new_y     -= (offset_x * 9 / 32);
                    break;

                case HitType.B:
                    new_height += offset_y;
                    new_width   = new_height * 16 / 9;
                    new_x      -= (offset_y * 16 / 18);
                    break;

                case HitType.T:
                    new_y      += offset_y;
                    new_height -= offset_y;
                    new_width   = new_height * 16 / 9;
                    new_x      += (offset_y * 16 / 18);
                    break;
                }

                // Save the mouse's new location.
                LastPoint = point;
                updateCropper(new_x, new_y, new_width, new_height);
            }
        }
コード例 #35
0
 public static bool HasTargetFlag(this HitType baseFlags, HitType flag)
 {
     return((baseFlags & flag) == flag);
 }
コード例 #36
0
 public double GetHitWindow(HitType hitType) =>
 DifficultyRange(overallDifficulty, hitRanges[hitType]);
コード例 #37
0
 public ContentExperiments(HitType hitType)
 {
     HitType = hitType;
 }
コード例 #38
0
 /// <summary>
 /// Send a datacollect hit
 /// </summary>
 /// <param name="type">The hit type</param>
 /// <param name="hit">The hit content</param>
 /// <returns></returns>
 public async Task SendHit(Visitor visitor, HitType type, BaseHit hit)
 {
     await sender.Send(visitor.Id, type, hit);
 }
コード例 #39
0
 void CmdChangeHitType(HitType hitType)//클라에서 서버에 스페이스입력으로 변한 hitType전달
 {
     this.hitType = hitType;
     Debug.Log(this.hitType);
 }
コード例 #40
0
        public HitType LookForHits(Dictionary <Bone, BoneData> segments, int playerId)
        {
            DateTime cur     = DateTime.Now;
            HitType  allHits = HitType.None;

            // Zero out score if necessary
            if (!scores.ContainsKey(playerId))
            {
                scores.Add(playerId, 0);
            }

            foreach (var pair in segments)
            {
                for (int i = 0; i < things.Count; i++)
                {
                    HitType hit   = HitType.None;
                    Thing   thing = things[i];
                    switch (thing.State)
                    {
                    case ThingState.Bouncing:
                    case ThingState.Falling:
                    {
                        var     hitCenter       = new Point(0, 0);
                        double  lineHitLocation = 0;
                        Segment seg             = pair.Value.GetEstimatedSegment(cur);
                        if (thing.Hit(seg, ref hitCenter, ref lineHitLocation))
                        {
                            if (seg.IsCircle())
                            {
                                if (thing.thingType == ThingType.Difficulty)
                                {
                                    SetGameDifficulty(Convert.ToInt32(difficultyOptions[thing.dropItemIndex].AnsText));
                                    dropItems.Clear();
                                    things.Clear();
                                }
                                else
                                {
                                    Guess guess = new Guess {
                                        GueAnsID = dropItems[thing.dropItemIndex].AnsID
                                    };
                                    if (Convert.ToBoolean(thing.correctAnswer))
                                    {
                                        hit |= HitType.Correct;
                                        AddToScore(thing.TouchedBy, 5, thing.Center);
                                        //if there are no more correct answers, get rid of all balloons.
                                        dropItems[thing.dropItemIndex].AnsInactive = true;
                                        bool moreCorrectAnswers = false;

                                        foreach (Answer answer in dropItems.Where(answer => Convert.ToBoolean(answer.AnsCorrect) && Convert.ToBoolean(answer.AnsInactive == false)))
                                        {
                                            moreCorrectAnswers = true;
                                        }

                                        if (!moreCorrectAnswers)
                                        {
                                            foreach (Answer answer in dropItems)
                                            {
                                                answer.AnsInactive = true;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        hit |= HitType.Incorrect;
                                    }
                                    //dropItems[thing.dropItemIndex].AnsInactive = true;
                                    thing.State = ThingState.Remove;
                                    things[i]   = thing;
                                }
                            }
                        }
                    }

                    break;
                    }

                    allHits |= hit;
                }
            }

            return(allHits);
        }
コード例 #41
0
ファイル: HitEventArgs.cs プロジェクト: TagsRocks/skill
 /// <summary>
 /// Create a HitInfo
 /// </summary>
 /// <param name="hitter"> The object that caused this hit </param>
 /// <param name="type"> Type of hit </param>
 /// <param name="collider"> Collider </param>
 public HitEventArgs(GameObject hitter, HitType type, UnityEngine.Collider collider)
 {
     this.Type     = type;
     this.Hitter   = hitter;
     this.Collider = collider;
 }
コード例 #42
0
ファイル: TreeControl.cs プロジェクト: GeertVL/ATF
 /// <summary>
 /// Initializes a new instance of the <see cref="HitRecord"/> struct.</summary>
 /// <param name="type">The type of object hit</param>
 /// <param name="node">The node hit</param>
 public HitRecord(HitType type, Node node)
 {
     Type = type;
     Node = node;
 }
コード例 #43
0
ファイル: CEnemy.cs プロジェクト: firerings/ski-proto-01
 protected void SetBulletInfo(int bullet_num_, Attribute attribute_, HitType hit_type_, float SPD_, float ATK_, State state_, float size_, int shooter_num_ = 0)
 {
     shooter[shooter_num_].SetBulletInfo(bullet_num_, attribute_, hit_type_, SPD_, ATK_, state_, size_);
 }
コード例 #44
0
ファイル: bl_Bullet.cs プロジェクト: SaltPeter/fps
 void OnHit(RaycastHit hit)
 {
     GameObject go = null;
     Ray mRay = new Ray(transform.position, transform.forward);
     if (!isTracer)  // if this is a bullet and not a tracer, then apply damage to the hit object
     {
         if (hit.rigidbody != null && !hit.rigidbody.isKinematic) // if we hit a rigi body... apply a force
         {
             float mAdjust = 1.0f / (Time.timeScale * (0.02f / Time.fixedDeltaTime));
             hit.rigidbody.AddForceAtPosition(((mRay.direction * impactForce) / Time.timeScale) / mAdjust, hit.point);
         }
     }
     switch (hit.transform.tag) // decide what the bullet collided with and what to do with it
     {
         case "Projectile":
             // do nothing if 2 bullets collide
             break;
         case "BodyPart"://Send Damage for other players
             if (hit.transform.GetComponent<bl_BodyPart>() != null && !isNetwork)
             {
                 hit.transform.GetComponent<bl_BodyPart>().GetDamage(damage, PhotonNetwork.player.name, GunName, DirectionFrom, OwnGunID);
             }
             go = GameObject.Instantiate(bloodParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             go.transform.parent = hit.transform;
             Destroy(this.gameObject);
             break;
         case "Wood":
             hitCount++; // add another hit to counter
             type = HitType.WOOD;
             go = GameObject.Instantiate(woodParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             go.transform.parent = hit.transform;
             MakeBulletHole(hit, hit.transform.gameObject);
             bl_UtilityHelper.PlayClipAtPoint(WoodSound, transform.position, 1.0f, AudioReferences);
             break;
         case "Concrete":
             hitCount += 2; // add 2 hits to counter... concrete is hard
             type = HitType.CONCRETE;
             go = GameObject.Instantiate(concreteParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(ConcreteSound, transform.position, 1.0f, AudioReferences);
             break;
         case "Glass":
             type = HitType.GLASS;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(MetalSound, transform.position, 1.0f, AudioReferences);
             break;
         case "Metal":
             hitCount += 3; // metal slows bullets alot
             type = HitType.METAL;
             go = GameObject.Instantiate(metalParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(MetalSound, transform.position, 1.0f, AudioReferences);
             break;
         case "oldMetal":
             hitCount += 3; // metal slows bullets alot
             type = HitType.OLD_METAL;
             go = GameObject.Instantiate(metalParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(MetalSound, transform.position, 1.0f, AudioReferences);
             break;
         case "Dirt":
             hasHit = true; // ground kills bullet
             type = HitType.CONCRETE;
             go = GameObject.Instantiate(sandParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(GenericSound, transform.position, 1.0f, AudioReferences);
             break;
         case "Water":
             hasHit = true; // water kills bullet
             go = GameObject.Instantiate(waterParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(WaterSound, transform.position, 1.0f, AudioReferences);
             break;
         default:
             hitCount++; // add a hit
             type = HitType.GENERIC;
             go = GameObject.Instantiate(genericParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
             MakeBulletHole(hit, hit.transform.gameObject);
             go.transform.parent = hit.transform;
             bl_UtilityHelper.PlayClipAtPoint(GenericSound, transform.position, 1.0f, AudioReferences);
             break;
     }
 }
コード例 #45
0
 private void RectOnMouseDown(Rectangle rectangle)
 {
     MouseHitType = SetHitType(rectangle, Mouse.GetPosition(canvas));
     SetMouseCursor();
     if (MouseHitType == HitType.None) return;
     LastPoint = Mouse.GetPosition(canvas);
     DragInProgress = true;
 }
コード例 #46
0
ファイル: Window1.xaml.cs プロジェクト: leminhtu1204/Editor
        // Start dragging.
        private void canvas1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MouseHitType = SetHitType(rectangle1, Mouse.GetPosition(canvas1));
            SetMouseCursor();
            if (MouseHitType == HitType.None) return;

            LastPoint = Mouse.GetPosition(canvas1);
            DragInProgress = true;
        }
コード例 #47
0
ファイル: ControlsScript.cs プロジェクト: Andi07/TestRepo
 public bool TestParryStances(HitType hitType)
 {
     if (UFE.config.blockOptions.parryType == ParryType.None) return false;
     if ((hitType == HitType.Mid || hitType == HitType.MidKnockdown || hitType == HitType.Launcher) && myPhysicsScript.IsGrounded()) return true;
     if ((hitType == HitType.Overhead || hitType == HitType.HighKnockdown) && currentState == PossibleStates.Crouch) return false;
     if ((hitType == HitType.Sweep || hitType == HitType.Low) && currentState != PossibleStates.Crouch) return false;
     if (!UFE.config.blockOptions.allowAirParry && !myPhysicsScript.IsGrounded()) return false;
     return true;
 }
コード例 #48
0
ファイル: BulletMarks.cs プロジェクト: jlonardi/igp-DnM
    public void GenerateDecal(HitType type, GameObject go)
    {
        Texture2D useTexture;
        int random;

        switch(type)
        {
            case HitType.CONCRETE:
                if(concrete == null) return;
                if(concrete.Length == 0) return;

                random = Random.Range(0, concrete.Length);

                useTexture = concrete[random];
                break;
            case HitType.WOOD:
                if(wood == null) return;
                if(wood.Length == 0) return;

                random = Random.Range(0, wood.Length);

                useTexture = wood[random];
                break;
            case HitType.METAL:
                if(metal == null) return;
                if(metal.Length == 0) return;

                random = Random.Range(0, metal.Length);

                useTexture = metal[random];
                break;
            case HitType.OLD_METAL:
                if(oldMetal == null) return;
                if(oldMetal.Length == 0) return;

                random = Random.Range(0, oldMetal.Length);

                useTexture = oldMetal[random];
                break;
            case HitType.GLASS:
                if(glass == null) return;
                if(glass.Length == 0) return;

                random = Random.Range(0, glass.Length);

                useTexture = glass[random];
                break;
            case HitType.GENERIC:
                if(generic == null) return;
                if(generic.Length == 0) return;

                random = Random.Range(0, generic.Length);

                useTexture = generic[random];
                break;
            default:
                if(wood == null) return;
                if(wood.Length == 0) return;

                random = Random.Range(0, wood.Length);

                useTexture = wood[random];
                return;
        }

        transform.Rotate(new Vector3(0, 0, Random.Range(-180.0f, 180.0f)));
        Decal.dCount++;
        Decal d = gameObject.GetComponent<Decal>();
        d.affectedObjects = new GameObject[1];
        d.affectedObjects[0] = go;
        d.decalMode = DecalMode.MESH_COLLIDER;
        d.pushDistance = 0.009f + BulletMarkManager.Add(gameObject);
        Material m = new Material(d.decalMaterial);
        m.mainTexture = useTexture;
        d.decalMaterial = m;
        d.CalculateDecal();
        d.transform.parent = go.transform;
    }
コード例 #49
0
 public ContentExperiments(HitType hitType)
 {
     _hitType = hitType;
 }
コード例 #50
0
    bool RollToHit(float baseToHit, HitType hitType, Character target)
    {
        float toHitChance = baseToHit;
        float roll = GameManager.GM.RollZeroToUnderOne();
        switch(hitType)
        {
            case HitType.NONE:
                {
                    //straight up roll < hit chance
                    break;
                }
            case HitType.PHYSICAL:
                {
                    toHitChance *= (1 + (GameSettings.phyHit_AttributeWeight * (actingUnit.sheet.stats.agility + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1 + (GameSettings.phyHit_LevelWeight * (actingUnit.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_AttributeWeight * (target.sheet.stats.agility + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_LevelWeight * (target.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    break;
                }
            case HitType.MAGICAL:
                {
                    toHitChance *= (1 + (GameSettings.phyHit_AttributeWeight * (actingUnit.sheet.stats.mind + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1 + (GameSettings.phyHit_LevelWeight * (actingUnit.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_AttributeWeight * (target.sheet.stats.mind + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_LevelWeight * (target.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    break;
                }
            case HitType.BOTH:
                {
                    toHitChance *= (1 + (GameSettings.phyHit_AttributeWeight * (actingUnit.sheet.stats.agility + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1 + (GameSettings.phyHit_LevelWeight * (actingUnit.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_AttributeWeight * (target.sheet.stats.agility + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_LevelWeight * (target.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    toHitChance *= (1 + (GameSettings.phyHit_AttributeWeight * (actingUnit.sheet.stats.mind + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1 + (GameSettings.phyHit_LevelWeight * (actingUnit.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_AttributeWeight * (target.sheet.stats.mind + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    toHitChance *= (1f / (1 + (GameSettings.phyHit_LevelWeight * (target.sheet.level + GameSettings.phyHit_RangeSpreadConstant) / 100f)));
                    break;
                }
            default:
                break;
        }

        Debug.Log("Chance to Hit : " + toHitChance.ToString() + "   Rolled : " + roll.ToString());
        return (roll < toHitChance);
    }
コード例 #51
0
ファイル: TaikoPlayfield.cs プロジェクト: yhsphd/osu
 private void addExplosion(DrawableHitObject drawableObject, HitResult result, HitType type)
 {
     hitExplosionContainer.Add(new HitExplosion(drawableObject, result));
     if (drawableObject.HitObject.Kiai)
     {
         kiaiExplosionContainer.Add(new KiaiHitExplosion(drawableObject, type));
     }
 }
コード例 #52
0
 public virtual void ApponentColliderIn(Stat.AttackStat attackStat, HitType hitType, ActionAnim actionAnim = null)
 {
 }
コード例 #53
0
ファイル: bl_Bullet.cs プロジェクト: SaltPeter/fps
    void OnBackHit(RaycastHit hit)
    {
        GameObject go;

        switch (hit.transform.tag) // decide what the bullet collided with and what to do with it
        {
            case "Projectile":
                // do nothing if 2 bullets collide
                break;
            case "Wood":
                type = HitType.WOOD;
                go = GameObject.Instantiate(woodParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                MakeBulletHole(hit, hit.transform.gameObject);
                go.transform.parent = hit.transform;
                break;
            case "Concrete":
                type = HitType.CONCRETE;
                go = GameObject.Instantiate(concreteParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                MakeBulletHole(hit, hit.transform.gameObject);
                go.transform.parent = hit.transform;
                break;
            case "Glass":
                type = HitType.GLASS;
                MakeBulletHole(hit, hit.transform.gameObject);
                break;
            case "Metal":
                type = HitType.METAL;
                go = GameObject.Instantiate(metalParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                MakeBulletHole(hit, hit.transform.gameObject);
                go.transform.parent = hit.transform;
                break;
            case "oldMetal":
                type = HitType.OLD_METAL;
                go = GameObject.Instantiate(metalParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                MakeBulletHole(hit, hit.transform.gameObject);
                go.transform.parent = hit.transform;
                break;
            case "Dirt":
                type = HitType.CONCRETE;
                go = GameObject.Instantiate(sandParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                MakeBulletHole(hit, hit.transform.gameObject);
                go.transform.parent = hit.transform;
                break;
            case "Water":
                go = GameObject.Instantiate(waterParticle, hit.point, Quaternion.FromToRotation(Vector3.up, hit.normal)) as GameObject;
                break;
            default:
                type = HitType.GENERIC;
                MakeBulletHole(hit, hit.transform.gameObject);
                break;
        }
    }
コード例 #54
0
        private async void GameLogic()
        {
            while (true)
            {
                for (var i = 0; i < _gameCount; i++)
                {
                    if (_isBreakThird && (i >= 2))
                    {
                        GameCompleted();
                        break;
                    }
                    var count = i + 1;
ReBegin:
                    var isBegin = await SendWcfCommandPluginsHelper.InvokerQueryDiaitalSwitchWithAutoUpload(_beginButtonItem, _queryTime);

                    if (isBegin)
                    {
                        await PlayTextMusicFromFirstItem("游戏开始");
                        await PlayMusic0("HitMouse", "P5_mixdown.mp3", "back", 0.2, true);

                        //关闭所有灯
                        await CloseAllLight();

                        await _roomLightRelayItem.Control(true);

                        //await PlayTextMusicFromFirstItem($"第{count}轮游戏开始");
                        //开始击打
                        //重建击打行为数据
                        var hitDatas = GetHitDatas();
                        switch (_hitBuff)
                        {
                        case HitType.Default:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        case HitType.Buff1:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        case HitType.Buff2:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        case HitType.Buff3:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount + 5);

                            break;

                        case HitType.Buff4:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount, true);

                            break;

                        case HitType.Buff5:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        case HitType.Buff6:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        case HitType.Buff7:
                            //全局的背景灯切换
                            RoomLightHelper.Start();
                            await HitTask.HitActionForBuffer7(hitDatas, this, hitDatas[0].ChargeHitCount);

                            //结束背景灯切换
                            await RoomLightHelper.Stop();

                            break;

                        case HitType.Buff8:
                            await HitTask.HitActionForDefault(hitDatas, this, hitDatas[0].ChargeHitCount);

                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                        await PauseMusic0("HitMouse", "back");

                        //await PlayTextMusicFromFirstItem($"第{count}轮游戏结束");
                        //选择招式
                        if (i + 1 != _gameCount)
                        {
                            if (_isBreakThird && (i >= 1))
                            {
                                //await PlayTextMusicFromFirstItem("本轮游戏胜利。");
                            }
                            else
                            {
                                await PlayTextMusicFromFirstItem("本轮游戏胜利,请选择下一轮游戏所要启动的招式。");
                            }
                            foreach (var questionLightRelayItem in _questionLightRelayItems)
                            {
                                await questionLightRelayItem.Control(true);
                            }
                            foreach (var styleLightRelayItem in _styleLightRelayItems)
                            {
                                await styleLightRelayItem.Control(true);
                            }
                            for (var j = 0; j < _chargeLightRelayItems.Count; j++)
                            {
                                if (j != _chargeLightRelayItems.Count - 1)
                                {
                                    await _chargeLightRelayItems[j].Control(false);
                                }
                            }
                            await _roomLightRelayItem.Control(false);

                            var hitSelector = _hitTypes.FirstOrDefault(s => s.Item1 == count);
                            _hitBuff = (HitType)Enum.ToObject(typeof(HitType), hitSelector.Item2);

                            var isPressQuestionButton = false;
                            while (!isPressQuestionButton)
                            {
                                if (_isBreakThird && (i >= 1))
                                {
                                    break;
                                }
                                var pressQuestionButtonItem = await SendWcfCommandPluginsHelper.NotificationButtonPressAsyncTask(_questionLightButtonItems, _queryTime);

                                if (pressQuestionButtonItem != null)
                                {
                                    await _chargeLightRelayItems[_chargeLightRelayItems.Count - 1].Control(false);
                                    await PlayMusic0("HitMouse", hitSelector.Item3, "buff");

                                    await Task.Delay(2000);

                                    isPressQuestionButton = true;
                                }
                            }
                            //var pressQuestionButtonItemIndex = _questionLightButtonItems.IndexOf(pressQuestionButtonItem);
                            for (var j = 0; j < _questionLightRelayItems.Count; j++)
                            {
                                await _questionLightRelayItems[j].Control(false);
                            }

                            //切换对应招式行为
                            //while (true)
                            //{
                            //    var tick = DateTime.Now.Ticks;
                            //    var random = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
                            //    var buttonIndex = random.Next(1, 8);
                            //    var hitType = (HitType)Enum.Parse(typeof(HitType), buttonIndex.ToString());
                            //    _hitBuff = hitType;
                            //}
                            var hitStyleData = _hitStyleDatas.FirstOrDefault(s => s.QuestionLightButtonIndex == _hitBuff.ToInt32());
                            if (hitStyleData == null)
                            {
                                throw new ArgumentNullException();
                            }

                            if (_isBreakThird && (i >= 1))
                            {
                                foreach (var hitStyleDataItem in _hitStyleDatas)
                                {
                                    foreach (var i1 in hitStyleDataItem.LightIndexs)
                                    {
                                        var   index = i1 - 1;
                                        await _styleLightRelayItems[index].Control(false);
                                    }
                                }
                            }
                            else
                            {
                                var usedStyleLightRelayItemIndexs = new List <int>();
                                foreach (var styleLightIndex in hitStyleData.LightIndexs)
                                {
                                    var index = styleLightIndex - 1;
                                    usedStyleLightRelayItemIndexs.Add(index);
                                    await _styleLightRelayItems[index].Control(true);
                                }
                                //关闭不需要的招式灯
                                await CloseStyleLights(usedStyleLightRelayItemIndexs);
                                await PlayTextMusicFromFirstItem(_hitBuff.GetEnumAttribute <TextToMusicAttribute>().Text);
                            }
                        }
                        else
                        {
                            GameCompleted();
                        }
                    }
                    else
                    {
                        goto ReBegin;
                    }
                }
                break;
            }
        }
コード例 #55
0
 /// <summary>
 /// 移除该控件并发送消息
 /// </summary>
 /// <param name="cs"></param>
 /// <param name="ste">0初始化 1 未被敲击 2 被敲中</param>
 /// <param name="ht"></param>
 private void RemoveAndSendMsg(CadenceSign cs, byte ste, HitType ht)
 {
     LayoutRoot.Children.Remove(cs.currentSign);
     indexActual++;
     cs.state = ste;
     HitArgs ha = new HitArgs();
     ha.HitType = ht;
     OnHit(this, ha);
 }
コード例 #56
0
        public HitType LookForHits(Dictionary <Bone, BoneData> segments, int playerId)
        {
            DateTime cur     = DateTime.Now;
            HitType  allHits = HitType.None;

            // Zero out score if necessary
            if (!scores.ContainsKey(playerId))
            {
                scores.Add(playerId, 0);
            }

            foreach (var pair in segments)
            {
                for (int i = 0; i < things.Count; i++)
                {
                    HitType hit   = HitType.None;
                    Thing   thing = things[i];
                    switch (thing.state)
                    {
                    case ThingState.Bouncing:
                    case ThingState.Falling:
                    {
                        var     ptHitCenter     = new Point(0, 0);
                        double  lineHitLocation = 0;
                        Segment seg             = pair.Value.GetEstimatedSegment(cur);
                        if (thing.Hit(seg, ref ptHitCenter, ref lineHitLocation))
                        {
                            double fMs = 1000;
                            if (thing.timeLastHit != DateTime.MinValue)
                            {
                                fMs = cur.Subtract(thing.timeLastHit).TotalMilliseconds;
                                thing.avgTimeBetweenHits = thing.avgTimeBetweenHits * 0.8 + 0.2 * fMs;
                            }
                            thing.timeLastHit = cur;

                            // Bounce off head and hands
                            if (seg.IsCircle())
                            {
                                // Bounce off of hand/head/foot
                                thing.BounceOff(ptHitCenter.X, ptHitCenter.Y, seg.radius,
                                                pair.Value.xVel / targetFrameRate, pair.Value.yVel / targetFrameRate);

                                if (fMs > 100.0)
                                {
                                    hit |= HitType.Hand;
                                }
                            }
                            else          // Bonce off line segment
                            {
                                double xVel = pair.Value.xVel * (1.0 - lineHitLocation) + pair.Value.xVel2 * lineHitLocation;
                                double yVel = pair.Value.yVel * (1.0 - lineHitLocation) + pair.Value.yVel2 * lineHitLocation;

                                thing.BounceOff(ptHitCenter.X, ptHitCenter.Y, seg.radius,
                                                xVel / targetFrameRate, yVel / targetFrameRate);

                                if (fMs > 100.0)
                                {
                                    hit |= HitType.Arm;
                                }
                            }

                            if (gameMode == GameMode.TwoPlayer)
                            {
                                if (thing.state == ThingState.Falling)
                                {
                                    thing.state      = ThingState.Bouncing;
                                    thing.touchedBy  = playerId;
                                    thing.hotness    = 1;
                                    thing.flashCount = 0;
                                }
                                else if (thing.state == ThingState.Bouncing)
                                {
                                    if (thing.touchedBy != playerId)
                                    {
                                        if (seg.IsCircle())
                                        {
                                            thing.touchedBy = playerId;
                                            thing.hotness   = Math.Min(thing.hotness + 1, 4);
                                        }
                                        else
                                        {
                                            hit |= HitType.Popped;
                                            AddToScore(thing.touchedBy, 5 << (thing.hotness - 1), thing.center);
                                        }
                                    }
                                }
                            }
                            else if (gameMode == GameMode.Solo)
                            {
                                if (seg.IsCircle())
                                {
                                    if (thing.state == ThingState.Falling)
                                    {
                                        thing.state      = ThingState.Bouncing;
                                        thing.touchedBy  = playerId;
                                        thing.hotness    = 1;
                                        thing.flashCount = 0;
                                    }
                                    else if ((thing.state == ThingState.Bouncing) && (fMs > 100.0))
                                    {
                                        hit |= HitType.Popped;
                                        AddToScore(thing.touchedBy,
                                                   (pair.Key.joint1 == JointID.FootLeft || pair.Key.joint1 == JointID.FootRight) ? 10 : 5,
                                                   thing.center);
                                        thing.touchedBy = playerId;
                                    }
                                }
                            }

                            things[i] = thing;

                            if (thing.avgTimeBetweenHits < 8)
                            {
                                hit |= HitType.Popped | HitType.Squeezed;
                                if (gameMode != GameMode.Off)
                                {
                                    AddToScore(playerId, 1, thing.center);
                                }
                            }
                        }
                    }
                    break;
                    }

                    if ((hit & HitType.Popped) != 0)
                    {
                        thing.state     = ThingState.Dissolving;
                        thing.dissolve  = 0;
                        thing.xVelocity = thing.yVelocity = 0;
                        thing.spinRate  = thing.spinRate * 6 + 0.2;
                        things[i]       = thing;
                    }
                    allHits |= hit;
                }
            }
            return(allHits);
        }
コード例 #57
0
ファイル: Window1.xaml.cs プロジェクト: leminhtu1204/Editor
        // If a drag is in progress, continue the drag.
        // Otherwise display the correct cursor.
        private void canvas1_MouseMove(object sender, MouseEventArgs e)
        {
            if (!DragInProgress)
            {
                MouseHitType = SetHitType(rectangle1, Mouse.GetPosition(canvas1));
                SetMouseCursor();
            }
            else
            {
                // See how much the mouse has moved.
                Point point = Mouse.GetPosition(canvas1);
                double offset_x = point.X - LastPoint.X;
                double offset_y = point.Y - LastPoint.Y;

                // Get the rectangle's current position.
                double new_x = Canvas.GetLeft(rectangle1);
                double new_y = Canvas.GetTop(rectangle1);
                double new_width = rectangle1.Width;
                double new_height = rectangle1.Height;

                // Update the rectangle.
                switch (MouseHitType)
                {
                    case HitType.Body:
                        new_x += offset_x;
                        new_y += offset_y;
                        break;
                    case HitType.UL:
                        new_x += offset_x;
                        new_y += offset_y;
                        new_width -= offset_x;
                        new_height -= offset_y;
                        break;
                    case HitType.UR:
                        new_y += offset_y;
                        new_width += offset_x;
                        new_height -= offset_y;
                        break;
                    case HitType.LR:
                        new_width += offset_x;
                        new_height += offset_y;
                        break;
                    case HitType.LL:
                        new_x += offset_x;
                        new_width -= offset_x;
                        new_height += offset_y;
                        break;
                    case HitType.L:
                        new_x += offset_x;
                        new_width -= offset_x;
                        break;
                    case HitType.R:
                        new_width += offset_x;
                        break;
                    case HitType.B:
                        new_height += offset_y;
                        break;
                    case HitType.T:
                        new_y += offset_y;
                        new_height -= offset_y;
                        break;
                }

                // Don't use negative width or height.
                if ((new_width > 0) && (new_height > 0))
                {
                    // Update the rectangle.
                    Canvas.SetLeft(rectangle1, new_x);
                    Canvas.SetTop(rectangle1, new_y);
                    rectangle1.Width = new_width;
                    rectangle1.Height = new_height;

                    // Save the mouse's new location.
                    LastPoint = point;
                }
            }
        }
コード例 #58
0
        //--------------------------------------
        //  HIT PROTOCOL
        //--------------------------------------

        public void SetHitType(HitType hit)
        {
            AppendData("t", hit.ToString().ToLower());
        }
コード例 #59
0
ファイル: Hits.cs プロジェクト: ramatronics/rsps
 public Hit(int damage, HitType type)
 {
     this.type = type;
     this.damage = damage;
 }
コード例 #60
0
 public HitAbstract(HitType type)
 {
     Type = type;
 }