コード例 #1
0
ファイル: Melee.cs プロジェクト: GlitchBoss/TextWars
 public void Hit(Player _player, WeaponCol _col)
 {
     if(isAttacking)
     {
         _player.TakeDamage(damage);
         _col.hasAttacked = true;
     }
 }
コード例 #2
0
    public void Start()
    {
        health    = maxHealth;
        weaponCol = GameObject.FindGameObjectWithTag("Point").GetComponent <WeaponCol>();

        ShowDataHudOBJ = GameObject.Find("ShowDataHud");
        showDataHUD    = ShowDataHudOBJ.GetComponent <ShowDataHUD>();

        thisCollider = gameObject.GetComponent <Collider>();

        healthBarBG.sizeDelta = new Vector2(health * 2, healthBar.sizeDelta.y);
    }
コード例 #3
0
ファイル: Melee.cs プロジェクト: joshhender/FaceOff
 public void Hit(Transform target, WeaponCol _col)
 {
     if (isAttacking)
     {
         if (target.GetComponent <CharacterHealth>())
         {
             target.GetComponent <CharacterHealth>().LoseHealth(damage);
         }
         else if (target.GetComponent <BackgroundFace>())
         {
             target.GetComponent <BackgroundFace>().LoseHealth(damage);
         }
         _col.hasAttacked = true;
     }
 }
コード例 #4
0
    private void Start()
    {
        HurtArray[0] = 30;
        HurtArray[1] = 30;
        HurtArray[2] = 30;
        HurtArray[3] = 80;
        HurtArray[4] = 80;
        HurtArray[5] = 80;

        weaponCol = GameObject.FindGameObjectWithTag("Point").GetComponent <WeaponCol>();
        activeGun = SaveData.WeaponEquiped;

        switch (activeGun)
        {
        case 0:
            weaponCol.HealthToRemove = HurtArray[0];
            break;

        case 1:
            weaponCol.HealthToRemove = HurtArray[1];
            break;

        case 2:
            weaponCol.HealthToRemove = HurtArray[2];
            break;

        case 3:
            weaponCol.HealthToRemove = HurtArray[3];
            break;

        case 4:
            weaponCol.HealthToRemove = HurtArray[4];
            break;

        case 5:
            weaponCol.HealthToRemove = HurtArray[5];
            break;


        default:
            break;
        }

        GunSelected(activeGun); //No tocar, permite la seleccion del arma
    }