CharacterStatus.GetItem C# (CSharp) Метод

GetItem() публичный Метод

public GetItem ( DropItem, itemKind ) : void
itemKind DropItem,
Результат void
    public void GetItem(DropItem.ItemKind itemKind)
    {
        switch (itemKind)
        {
            case DropItem.ItemKind.Attack:
                powerBoostTime = 5.0f;
                powerUpEffect.Play ();
                break;
            case DropItem.ItemKind.Heal:
                // MaxHP의 절반 회복.
                HP = Mathf.Min(HP + MaxHP / 2, MaxHP);
                break;
        }
    }

Usage Example

Пример #1
0
 void OnTriggerEnter(Collider other)
 {
     // Player인지 판정.
     if (other.tag == "Player")
     {
         // 아이템 획득.
         CharacterStatus aStatus = other.GetComponent <CharacterStatus>();
         aStatus.GetItem(kind);
         // 오디오 재생.
         AudioSource.PlayClipAtPoint(itemSeClip, transform.position);
         // 아이템 획득을 소유자에게 알린다.
         PlayerCtrl playerCtrl = other.GetComponent <PlayerCtrl>();
         if (playerCtrl.networkView.isMine)
         {
             if (networkView.isMine)
             {
                 GetItemOnNetwork(playerCtrl.networkView.viewID);
             }
             else
             {
                 networkView.RPC("GetItemOnNetwork", networkView.owner, playerCtrl.networkView.viewID);
             }
         }
     }
 }
All Usage Examples Of CharacterStatus::GetItem