Beispiel #1
0
        public override void InitializeEditingControl(int rowIndex, object
                                                      initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            CtrlTextCell ctl = DataGridView.EditingControl as CtrlTextCell;

            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
            if (this.OwningColumn is CtrlDGVCurrencyColumn)
            {
                CtrlDGVCurrencyColumn column = this.OwningColumn as CtrlDGVCurrencyColumn;
                this.TextType = column.TextType;
            }
            else if (this.OwningColumn is CtrlDGVCreditDebitColumn)
            {
                CtrlDGVCreditDebitColumn column = this.OwningColumn as CtrlDGVCreditDebitColumn;
                this.TextType = column.TextType;
            }
            else if (this.OwningColumn is CtrlDGVYesNoColumn)
            {
                CtrlDGVYesNoColumn column = this.OwningColumn as CtrlDGVYesNoColumn;
                this.TextType = column.TextType;
            }
            ctl.TextType  = this.TextType;
            ctl.TextAlign = TextHelper.TranslateGridColumnAligment(this.Style.Alignment);
            if (Value == null)
            {
            }
            else
            {
                ctl.Text = this.Value.ToString();
            }
        }
Beispiel #2
0
 // This function should be called by whoever deals damage to the barricade
 public void receiveDamage(int amount)
 {
     UI.S.PlaySound("Hit");
     health -= amount;
     HitText.Create(this.transform.position, amount);
     checkHealth();
 }
Beispiel #3
0
 public void receiveDamage(int amount)
 {
     this.Health -= amount;
     HitText.Create(this.transform.position, amount);
     if (Health <= 0)
     {
         Destroy(this.gameObject);
     }
 }
Beispiel #4
0
    private void ShowHitText(string text, Color colour)
    {
        HitText ht        = Instantiate(hitTextPrefab, mainUI.transform);
        Vector2 screenPos = mainCamera.WorldToScreenPoint(transform.position);

        screenPos.x /= mainCamera.pixelWidth;
        screenPos.y /= mainCamera.pixelHeight;
        ht.DisplayHitText(text, colour, screenPos);
    }
Beispiel #5
0
    void OnTriggerEnter(Collider coll)
    {
        if (!coll.CompareTag("Unit"))
        {
            return;
        }

        UI.S.PlaySound("CandyCollect");
        ResourceManager.S.AddResources(value);
        HitText.CreateYellow(this.transform.position, value);
        Destroy(gameObject);
    }
Beispiel #6
0
    /// <summary>
    /// 創造擊中文字物件
    /// </summary>
    static HitText SpawnHitText()
    {
        //創造物件並初始化
        GameObject go_hitText = GameObject.Instantiate(Prefab_HitText, Vector2.zero, Quaternion.identity) as GameObject;

        go_hitText.transform.SetParent(MyTransform);
        HitText hitText = go_hitText.GetComponent <HitText>();

        hitText.Init();
        //加入清單
        HitTextList.Add(hitText);
        return(hitText);
    }
Beispiel #7
0
    private static void CreateInternal(GameObject prefab, Vector3 position, string val)
    {
        if (anchor == null)
        {
            anchor = new GameObject("HitTextAnchor");
        }

        GameObject hitText = Instantiate(prefab);

        position.z = -2;
        hitText.transform.position = position;
        hitText.transform.SetParent(anchor.transform);

        HitText script = hitText.GetComponentInChildren <HitText>();

        script.text.text = val;
    }
Beispiel #8
0
    void Start()
    {
        spellButton1 = spellButton1.GetComponent <Button>();
        spellButton1.onClick.AddListener(Spell1Cast);
        spellButton2 = spellButton2.GetComponent <Button>();
        spellButton2.onClick.AddListener(Spell2Cast);
        spellButton3 = spellButton3.GetComponent <Button>();
        spellButton3.onClick.AddListener(Spell3Cast);
        spellButton4 = spellButton4.GetComponent <Button>();
        spellButton4.onClick.AddListener(Spell4Cast);
        spellButton5 = spellButton5.GetComponent <Button>();
        spellButton5.onClick.AddListener(Spell5Cast);
        spellButton6 = spellButton6.GetComponent <Button>();
        spellButton6.onClick.AddListener(Spell6Cast);

        hitText = GetComponent <HitText>();

        turnManager             = GameObject.FindGameObjectWithTag("GameController").GetComponent <TurnManager>();
        gridController          = GameObject.FindGameObjectWithTag("GameController").GetComponent <GridController>();
        abilities               = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <Abilities>();
        turnManager.TurnChange += HandleTurnChange;
        turnManager.TurnEnd    += HandleTurnEnd;
        if (!gridController)
        {
            Debug.LogWarning("Gridcontroller is null!");
        }
        if (!turnManager)
        {
            Debug.Log("Could not find turnManager component in parents!");
        }
        if (!abilities)
        {
            Debug.Log("Could not find abilities component");
        }
        if (!sEffects)
        {
            sEffects = GameObject.FindGameObjectWithTag("GameController").GetComponent <StatusEffects>();
        }
        //cv = turnManager.teamManager.activePlayer.thisCharacter;
        UpdateHpApMp();
    }
Beispiel #9
0
 public void receiveDamage(int amount)
 {
     if (type == UnitType.Balloon)
     {
         UI.S.PlaySound("FlyingHurt");
     }
     else if (type == UnitType.Archer)
     {
         UI.S.PlaySound("FemaleHurt");
     }
     else
     {
         UI.S.PlaySound("MaleHurt");
     }
     this.health -= amount;
     HitText.Create(this.transform.position, amount);
     if (this.health <= 0)
     {
         //Death
         Destroy(this.gameObject);
     }
 }
 void Start()
 {
     teamManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <TeamManager>();
     hitText     = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <HitText>();
     turnManager = GameObject.FindGameObjectWithTag("GameController").GetComponent <TurnManager>();
 }
        public string TextDescribe()
        {
            string returnstring = "*";

            returnstring += _Attack + ":* +";
            returnstring += Bonus;

            if (!Bonus.ToLower().Contains("hit"))
            {
                returnstring += " to hit, ";
            }


            if (Reach > 0)
            {
                returnstring += "reach " + Reach + " ft., ";
            }

            if (Reach > 0 && (RangeFar > 0 || RangeClose > 0))
            {
                returnstring += " or ";
            }

            if (RangeClose > 0)
            {
                returnstring += "range " + RangeClose;
                if (RangeFar > 0 && RangeFar != RangeClose)
                {
                    returnstring += "/" + RangeFar;
                }
                returnstring += " ft., ";
            }

            returnstring += Target;

            if (!String.IsNullOrEmpty(Target) || !String.IsNullOrWhiteSpace(Target))
            {
                if (Target[Target.Length - 1] != '.')
                {
                    returnstring += ".";
                }
            }

            returnstring += " *Hit:* ";

            if (HitDiceNumber > 0)
            {
                returnstring += HitAverageDamage + " (" + HitDiceNumber + "d" + HitDiceSize;
                if (HitDamageBonus != 0)
                {
                    if (HitDamageBonus > -1)
                    {
                        returnstring += "+";
                    }
                    returnstring += HitDamageBonus + ") " + HitDamageType.ToLower() + " damage";
                }
                returnstring += HitDamageBonus;
            }
            returnstring += ") " + HitDamageType.ToLower() + " damage";

            if (HitText.Split(' ')[0].ToLower() == "and" || HitText.Split(' ')[0].ToLower() == "or" || HitText.Split(' ')[0].ToLower() == "plus")
            {
                returnstring += " ";
            }
            else
            {
                returnstring += ". ";
            }

            returnstring += HitText;

            return(returnstring);
        }
 public void AddHitText(string text) {
     HitText hitText = new HitText();
     hitTexts.Add(hitText);
     Vector3 screenPos = Camera.main.WorldToScreenPoint(transform.position);
     hitText.ShowText(text, GameProperties.HITS_TEXT_TIME, screenPos.x, screenPos.y);
 }
Beispiel #13
0
    void ManageArrows()
    {
        bool[] input = GetInput();
        for (int i = 0; i < 4; i++)
        {
            if (input[i])
            {
                if (_PlayerArrows[i]._HeldNote != null)
                {
                    _PlayerArrows[i].StartGlow();
                    _Health += SecondsToBeats(Time.deltaTime) * Global._HealthPerHit;
                    _Score  += SecondsToBeats(Time.deltaTime) * 100;
                }
                _PlayerArrows[i]._Pressed = true;
            }
            else
            {
                _PlayerArrows[i]._Pressed        = false;
                _PlayerArrows[i]._GotPressResult = false;
                if (_PlayerArrows[i]._HeldNote != null)
                {
                    _PlayerArrows[i]._HeldNote.ReleaseTrail();
                    _PlayerArrows[i]._HeldNote.GetHit(false);
                    _PlayerArrows[i]._HeldNote = null;
                }
            }

            if (_PlayerArrows[i]._Pressed && _PlayerArrows[i]._GotPressResult == false)
            {
                Collider2D[] colliders = Physics2D.OverlapBoxAll(_PlayerArrows[i].transform.position, Vector2.one * _MaxHitDistance, 0);
                Key          hitKey    = null;

                float minDistance = _MaxHitDistance;

                foreach (Collider2D collider in colliders)
                {
                    Key key = collider.GetComponent <Key>();
                    if (key)
                    {
                        float distance = Mathf.Abs(_PlayerArrows[i].transform.position.y - collider.transform.position.y);
                        if (distance < _MaxHitDistance && (!hitKey || distance < minDistance))
                        {
                            hitKey      = key;
                            minDistance = distance;
                        }
                    }
                }
                if (hitKey)
                {
                    HitText hit = Instantiate(_HitTextPrefab, Vector3.zero, Quaternion.identity).GetComponent <HitText>();
                    if (minDistance < _MaxHitDistance * _PerfectHitRange)
                    {
                        hit._Text.text = "Perfect!";
                    }
                    else if (minDistance < _MaxHitDistance * _GreatHitRange)
                    {
                        hit._Text.text = "Great!";
                    }
                    else if (minDistance < _MaxHitDistance * _GoodHitRange)
                    {
                        hit._Text.text = "Good";
                    }
                    else
                    {
                        hit._Text.text = "Ok.";
                    }

                    float percent = Mathf.Abs(1 - (minDistance / _MaxHitDistance));
                    _Score  += Mathf.RoundToInt(_ScoreScaling.Evaluate(percent) * 100);
                    _Health += Mathf.RoundToInt(Global._HealthPerHit * _ScoreScaling.Evaluate(percent));

                    if (hitKey._Duration != 0)
                    {
                        hitKey._IsHeld             = true;
                        _PlayerArrows[i]._HeldNote = hitKey;
                        hitKey.transform.position  = _PlayerArrows[i].transform.position;
                    }
                    else
                    {
                        hitKey.GetHit(false);
                    }

                    _PlayerArrows[i].StartGlow();
                }
                else
                {
                    MissNote(Global._HealthPerMiss / 2);
                    _Score -= 10;
                }
                _PlayerArrows[i]._GotPressResult = true;
            }
        }
    }
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(HitText _hitText)
 {
     MyHitText = _hitText;
 }
Beispiel #15
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(HitText _hitText)
 {
     MyHitText = _hitText;
 }
Beispiel #16
0
 public static bool IsHitTextGone(HitText ht)
 {
     return(!ht.Alive);
 }