コード例 #1
0
ファイル: HitInfo.cs プロジェクト: WarzesProject/Game01
 public HitInfo(DamageConfig damage, Vector3 point, bool isShowEffect, HitSources source)
 {
     this.damage       = damage;
     this.point        = point;
     this.isShowEffect = isShowEffect;
     this.source       = source;
 }
コード例 #2
0
 public ItemWeaponMelee() :
     base()
 {
     itemType        = ItemTypes.WeaponMelee;
     weaponMeleeType = WeaponMeleeTypes.Sword;
     damage          = new DamageConfig();
 }
コード例 #3
0
 protected BaseCharacterAction(string iconPath, float baseActionTime, DamageConfig damageConfig, bool targetsEnemies, bool targetsAllies)
 {
     this.icon           = SingletonProvider.MainGameobjectLoader.GetPrefab <Sprite>(iconPath);
     this.iconPath       = iconPath;
     this.baseActionTime = baseActionTime;
     this.damageConfig   = damageConfig;
     this.targetsEnemies = targetsEnemies;
     this.targetsAllies  = targetsAllies;
 }
コード例 #4
0
    public int CalculateFinalDamage(DamageConfig damage, bool fromPlayer = false)
    {
        int final = 0;

        final  = (int)(Random.Range(damage.minPhysical, damage.maxPhysical) * (1f - Mathf.Clamp(physical, 0f, 1f)));
        final += (int)(damage.fire * (1f - Mathf.Clamp(fire, 0f, 1f)));
        final += (int)(damage.ice * (1f - Mathf.Clamp(ice, 0f, 1f)));
        final += (int)(damage.electro * (1f - Mathf.Clamp(electro, 0f, 1f)));
        return(final);
    }
コード例 #5
0
    public DamageConfig Copy()
    {
        DamageConfig newConfig = new DamageConfig();

        newConfig.minPhysical = this.minPhysical;
        newConfig.maxPhysical = this.maxPhysical;
        newConfig.fire        = this.fire;
        newConfig.ice         = this.ice;
        newConfig.electro     = this.electro;
        return(newConfig);
    }
コード例 #6
0
    // by the animation event
    public void OnAttack()
    {
        if (weapon == null)
        {
            return;
        }
        PlayerController player = PlayerController.Instance;

        if (weapon.itemType == Item.ItemTypes.Staff)
        {
            ItemWeaponStaff staff = (ItemWeaponStaff)weapon;
            if (player.Mana >= staff.mana)
            {
                Instantiate(staff.bullet, player.mainCamera.transform.position, player.mainCamera.transform.rotation);
                player.Mana -= staff.mana;
            }
            else
            {
                UIController.Instance.ShowError("Not enought mana");
            }
        }
        else
        {
            RaycastHit hit;
            if (Physics.Raycast(player.mainCamera.transform.position, player.mainCamera.transform.TransformDirection(Vector3.forward), out hit, 4))
            {
                IHitable hitable = hit.collider.gameObject.GetComponent(typeof(IHitable)) as IHitable;
                if (hitable != null)
                {
                    DamageConfig damageWithStreanght = ((ItemWeaponMelee)weapon).damage.Copy();
                    damageWithStreanght.minPhysical += (int)(damageWithStreanght.minPhysical * 0.05f * PlayerController.Instance.experience.ActualStrenght);
                    damageWithStreanght.maxPhysical += (int)(damageWithStreanght.maxPhysical * 0.05f * PlayerController.Instance.experience.ActualStrenght);
                    hitable.Hit(new HitInfo(damageWithStreanght, hit.point, true, HitInfo.HitSources.Player));
                }
            }
        }
    }
コード例 #7
0
 public AttackSpecificAction(string iconPath, float baseActionTime, DamageConfig damageConfig) : base(iconPath, baseActionTime, damageConfig, true, false)
 {
 }
コード例 #8
0
 public AttackRandomAction(string iconPath, float baseActionTime, DamageConfig damage) : base(iconPath, baseActionTime, damage, true, false)
 {
 }