コード例 #1
0
ファイル: Square.cs プロジェクト: pogin503/TOL_SRPG
        public HitStatus CheckHitWall(S3DLine line, out Wall res_wall)
        {
            HitStatus tmp_hs   = null;
            Wall      tmp_wall = null;

            // 壁の描画
            foreach (var wall_line in walls)
            {
                foreach (var wall in wall_line)
                {
                    var hs = wall.panel.CheckHit(line);
                    if ((tmp_hs == null || tmp_hs.range > hs.range) && (hs.is_hit))
                    {
                        tmp_hs   = hs;
                        tmp_wall = wall;
                    }
                }
            }
            if (tmp_hs == null)
            {
                tmp_hs = new HitStatus();
            }

            res_wall = tmp_wall;
            return(tmp_hs);
        }
コード例 #2
0
        /// <summary>
        /// Returns integer indicating which handle was touched.
        /// For vertex mode it returns the indices for the touched grabhandle for the vertex
        /// </summary>
        /// <param name="ray"></param>
        /// <returns></returns>
        public int CheckHit(Ray ray)
        {
            if (mHandles.Count <= 0)
            {
                return((int)(LastHitStatus = HitStatus.None));
            }

            // default HandleMode.Resize
            int startIndex = 0;
            int endIndex   = BRUSH_MANIPULATION_HANDLE_COUNT;

            if (Mode == HandleMode.Rotate)
            {
                endIndex = 4;
            }
            else if (Mode == HandleMode.Skew)
            {
                startIndex = 4;
            }

            for (int i = startIndex; i < endIndex; i++)
            {
                SolidGrabHandle handle = mHandles[i];
                if (ray.IsIntersecting(handle.BottomLeft, handle.BottomRight, handle.TopRight, handle.TopLeft))
                {
                    return((int)(LastHitStatus = (HitStatus)i + 1));
                }
            }

            return((int)(LastHitStatus = HitStatus.None));
        }
コード例 #3
0
    private void ShowDamageBurst(HitStatus status, int damage = 0)
    {
        var             clone      = (GameObject)Instantiate(this.damageNumbers, this.gameObject.transform.position, Quaternion.Euler(Vector3.zero));
        FloatingNumbers damageText = clone.GetComponent <FloatingNumbers>();

        damageText.SetDamageDone(damage);
        damageText.SetHitStatus(status);
    }
コード例 #4
0
 public void ShowHitAlert()
 {
     if (CurrentPlayerTracker.currentPlayer.GetComponent <StealthPlayerSwitcher>().myIndex == 0)
     {
         targetHitName = PlayerNames.playerOneName;
     }
     else if (CurrentPlayerTracker.currentPlayer.GetComponent <StealthPlayerSwitcher>().myIndex == 1)
     {
         targetHitName = PlayerNames.playerTwoName;
     }
     hitStatus = HitStatus.HIT;
     StartCoroutine(HideHitAlert(3f));
 }
コード例 #5
0
        public int UpdateConnectionStatus(int id, HitStatus hitStatus, ConnectionStatus connectionStatus)
        {
            var contract = this.contracts.GetById(id);

            if (contract == null)
            {
                return(-1);
            }

            contract.Status = connectionStatus;
            this.contracts.Update(contract);

            return(this.contracts.SaveChanges());
        }
コード例 #6
0
ファイル: BattleMap.cs プロジェクト: pogin503/TOL_SRPG
        public void UpdateInterface()
        {
            // カーソル更新
            map_cursor_x = -1;
            map_cursor_y = -1;
            var mouse_lay = S3DLine.GetMouseLay();

            // 地面(表面)とのカーソル判定
            HitStatus ground_hit_status = null;

            foreach (var sq in map_squares)
            {
                //var sq = map_squares[x + y * map_w];
                var hs = sq.CheckHitGround(mouse_lay);

                if ((ground_hit_status == null || ground_hit_status.range > hs.range) && (hs.is_hit))
                {
                    ground_hit_status = hs;
                    map_cursor_x      = sq.map_x;
                    map_cursor_y      = sq.map_y;
                }
            }

            // 壁面(側面)とのカーソル判定
            if (is_use_map_cursor_wall)
            {
                HitStatus wall_hit_status = null;
                Wall      hit_wall        = null;
                map_cursor_wall = null;
                foreach (var sq in map_squares)
                {
                    //var sq = map_squares[x + y * map_w];
                    Wall wall;
                    var  hs = sq.CheckHitWall(mouse_lay, out wall);
                    if ((wall_hit_status == null || wall_hit_status.range > hs.range) && (hs.is_hit))
                    {
                        wall_hit_status = hs;
                        hit_wall        = wall;
                    }
                }
                if (wall_hit_status != null)
                {
                    if (ground_hit_status == null /*|| (ground_hit_status.range < wall_hit_status.range)*/)
                    {
                    }
                    map_cursor_wall = hit_wall;
                }
            }

            // ユニットのカーソル判定(こっちがあるなら上書きする)
            {
                var game_main = GameMain.GetInstance();
                //var line = S3DLine.GetMouseLay();
                var  range = 0.0;
                Unit tmp_u = null;
                foreach (var u in game_main.unit_manager.units)
                {
                    var hs = u.unit.CheckHit(mouse_lay);
                    if (hs.is_hit)
                    {
                        if (tmp_u == null || range > hs.range)
                        {
                            tmp_u = u.unit;
                            range = hs.range;
                        }
                    }
                }
                if (tmp_u != null)
                {
                    map_cursor_x = tmp_u.map_x;
                    map_cursor_y = tmp_u.map_y;
                }
            }

            UpdateInterface_Cursors();
        }
コード例 #7
0
    public void TryAttack(StatsManager other)
    {
        bool canReceiveAttack = true;

        if (other.gameObject.tag == "Enemy")
        {
            var enemy = other.gameObject.GetComponent <EnemyController>();
            canReceiveAttack = enemy.CanReceiveAttack();
        }
        if (canReceiveAttack)
        {
            int       damage = 0;
            string    messageWhenTryingAttack = string.Empty;
            HitStatus status = this.DidHit(other);
            switch (status)
            {
            case HitStatus.EpicFail:
                damage = this.EpicFail();
                break;

            case HitStatus.FacePalm:
                // Missed
                UIManager.outputMessages.Add(string.Format("{0} missed {1}", this.GetName(), other.GetName()));
                break;

            case HitStatus.NotBad:
                messageWhenTryingAttack += string.Format("{0} hit {1}", this.GetName(), other.GetName());
                UIManager.outputMessages.Add(messageWhenTryingAttack);
                damage = this.RollDamage(other);
                if (("" + UIManager.outputMessages[UIManager.outputMessages.Count - 1]).Contains("experience"))
                {
                    UIManager.outputMessages[UIManager.outputMessages.Count - 2] += string.Format(" by {0}", damage);
                }
                else
                {
                    UIManager.outputMessages[UIManager.outputMessages.Count - 1] += string.Format(" by {0}", damage);
                }
                break;

            case HitStatus.YoureAwesome:
                messageWhenTryingAttack += string.Format("{0} critically hit {1}", this.GetName(), other.GetName());
                UIManager.outputMessages.Add(messageWhenTryingAttack);
                damage  = this.RollDamage(other);
                damage += this.RollDamage(other);
                if (("" + UIManager.outputMessages[UIManager.outputMessages.Count - 1]).Contains("experience"))
                {
                    UIManager.outputMessages[UIManager.outputMessages.Count - 2] += string.Format(" by {0}", damage);
                }
                else
                {
                    UIManager.outputMessages[UIManager.outputMessages.Count - 1] += string.Format(" by {0}", damage);
                }
                break;
            }
            this.ShowDamageBurst(status, damage);
            if (damage > 0)
            {
                other.flashAfterTakingDamage        = true;
                other.flashAfterTakingDamageCounter = other.flashAfterTakingDamageLength;
                if (other.gameObject.tag == "Player")
                {
                    this.sfxManager.playerHurt.Play();
                }

                this.sceneManager.SetObjectsThatTouch(this.gameObject, other.gameObject);

                // DB: Save who took damage
            }
        }
        else
        {
            UIManager.outputMessages.Add("INVULNERABLE!");
            var             clone      = (GameObject)Instantiate(this.damageNumbers, this.gameObject.transform.position, Quaternion.Euler(Vector3.zero));
            FloatingNumbers damageText = clone.GetComponent <FloatingNumbers>();
            damageText.SetHitStatus(HitStatus.Invulnerable);
        }
    }
コード例 #8
0
        public void TestHighlight()
        {
            ElasticSearch.Client.ElasticSearchClient client = new ElasticSearchClient("localhost", 9200, TransportType.Http);


            string indexName = Guid.NewGuid().ToString();


            client.CreateIndex(indexName);


            TypeSetting type = new TypeSetting("type");

            type.AddStringField("title").Analyzer   = "whitespace";
            type.AddStringField("snippet").Analyzer = "whitespace";
            client.PutMapping(indexName, type);

            //index sample
            Dictionary <string, object> dict = new Dictionary <string, object>();

            dict["title"]   = "quick fox jump away";
            dict["snippet"] = "quick fox jump away,where are you?";
            client.Index(indexName, "type", "1", dict);

            dict            = new Dictionary <string, object>();
            dict["title"]   = "fox river is nearby";
            dict["snippet"] = "where is fox river,where is it?";
            client.Index(indexName, "type", "2", dict);


            ElasticQuery query = new ElasticQuery(
                new QueryStringQuery("fox")
                .AddField("title", 5)
                .AddField("snippet", 5), null, 0, 5);

            query.AddHighlightField(new HightlightField("title"));
            query.AddHighlightField(new HightlightField("snippet"));

            client.Refresh(indexName);

            var result = client.Search(indexName, query);

            Console.Out.WriteLine(result.Query);
            Console.Out.WriteLine(result.Response);

            Console.Out.WriteLine("---");
            HitStatus hits = result.GetHits();

            if (hits != null)
            {
                foreach (var o in hits.Hits)
                {
                    foreach (var pair in o.Highlight)
                    {
                        Console.Out.WriteLine(pair.Key + ":");
                        foreach (var field in pair.Value)
                        {
                            Console.Out.WriteLine(field);
                        }

                        Console.Out.WriteLine();
                    }
                }
            }


            client.DeleteIndex(indexName);
        }
コード例 #9
0
        public int UpdateConnectionStatus(int id, HitStatus hitStatus, ConnectionStatus connectionStatus)
        {
            var contract = this.contracts.GetById(id);

            if (contract == null)
            {
                return -1;
            }

            contract.Status = connectionStatus;
            this.contracts.Update(contract);

            return this.contracts.SaveChanges();
        }
コード例 #10
0
 public void SetHitStatus(HitStatus status)
 {
     this.hitStatus = status;
 }
コード例 #11
0
    IEnumerator HideHitAlert(float delay)
    {
        yield return(new WaitForSeconds(delay));

        hitStatus = HitStatus.NO_HIT;
    }
コード例 #12
0
 // Use this for initialization
 void Start()
 {
     hitStatus = HitStatus.NO_HIT;
     hitAlert  = GetComponent <Text>();
 }
コード例 #13
0
    /*
     * Caclulates score, and handles intialization of HOT MODE if prerequisite is met
     *
     * Params status (event occured)
     * - MISS_PRESS		key pressed but incorrectly
     * - HIT			correct key pressed, correct timing
     * - MISS			BeatMarker goes out without hit
     *
     * HIT is worth of a point (+1)
     * MISS and MISS_PRESS gives negative points as defined in Unity (Normal Mode Fail Multiplier
     * HOT MODE hit is worth poins as defined in Unity GUI (Hot Mode Scor Multiplier)
     * HOT MODE fail gives minus points as defined in Unity GUI (Hot Mode Fail Multiplier)
     */
    private void UpdateScore(HitStatus hitStatus)
    {
        int hitMultiplier;
        int failMultiplier;
        if (hotMode) {
            hitMultiplier = hotModeScoreMultiplier;
            failMultiplier = hotModeFailMultiplier;
        } else {
            hitMultiplier = 1;
            failMultiplier = normalModeFailMultiplier;
        }

        switch(hitStatus) {
            case HitStatus.HIT:
                //if (successesInRow < hotModeRequisite && hotMode==false) {
                successesInRow++;
                //}
                correntHits++;
                score += baseScore * hitMultiplier;
                if (successesInRow > 0 && successesInRow % 10 == 0){
                    BroadcastWatchDancePerception();
                }
                break;
            case HitStatus.MISS:
                errors++;
                score -= baseScore * failMultiplier;
                successesInRow=0;
                if (hotMode==true) {
                    TerminateHotMode(true);
                }
                break;
            case HitStatus.MISS_PRESS:
                errors++;
                score -= baseScore * failMultiplier;
                successesInRow=0;
                if (hotMode==true) {
                    TerminateHotMode(true);
                }
                break;
            default:
                Debug.LogError("DanceModeController.UpdateScore() invalid status received");
                return;
        }
        if(successesInRow == hotModeRequisite && hotMode==false) {
            //Debug.Log("calcScore(): entering HOT MODE");
            StartHotMode();
        }
        // Score cannot go below zero
        if(score<0) { score=0; }
        // Score cannot exceed 100
        if(score>100) { score=100;}
        FModManager.SetMusicParameterValue(FModLies.MUSICPARAM_LIES_DANCE_POINTS,score/10);
        //Debug.Log("DanceModeController.UpdateScore() Score: " + score + " SuccessesInRow: " + successesInRow + " HOT MODE: " + hotMode );
    }