コード例 #1
0
    /// <summary>
    /// Shows or hides the active bodypart of the current move to play.
    /// </summary>
    /// <param name="show">If set to <c>true</c> show.</param>
    public void ShowActiveBodypart(bool show)
    {
        if (this.moveToPlay == null)
        {
            return;             //Do nothing if there is no move to play.
        }
        Transform bodypart = UnityUtils.RecursiveFind(transform, this.moveToPlay.GetActiveBodypart());
        Transform shield   = UnityUtils.RecursiveFind(transform, this.moveToPlay.GetActiveBodypart().Replace(" ", "") + "Shield");

        if (bodypart != null && bodypart.gameObject.GetComponent <ColorModifier> () != null && !moveToPlay.IsBlockMove())
        {
            //Highlight damage dealer if move is not a block move and show true, hide otherwise.
            bodypart.gameObject.GetComponent <ColorModifier> ().SetSelected(show);
        }
        if (shield != null && moveToPlay.IsBlockMove())
        {
            //Show shield if move is a block move and show true, hide otherwise.
            shield.gameObject.GetComponent <SpriteRenderer> ().enabled = show;
            ShieldControl shieldControl = shield.GetComponent <ShieldControl> ();
            if (shieldControl != null)
            {
                shieldControl.UpdateScale(moveToPlay);
            }
        }
    }
コード例 #2
0
ファイル: MoveCreator.cs プロジェクト: Bergmam/2DHwaiting
 private void UpdateShieldScale()
 {
     if (move.IsBlockMove() && GameObject.Find(move.GetActiveBodypart().Replace(" ", "") + "Shield") != null)
     {
         GameObject    shield        = GameObject.Find(move.GetActiveBodypart().Replace(" ", "") + "Shield");
         ShieldControl shieldControl = shield.GetComponent <ShieldControl> ();
         if (shieldControl != null)
         {
             shieldControl.UpdateScale(move);
         }
     }
 }