-
Автор темы
- #1
Assets\Scripts\AbilityScript.cs(33,12): error CS1520: Method must have a return type
C#:
using UnityEngine;
public class Ability
{
public enum AmplifierType
{
PLUS_CLICK_DAMAGE,
CLICK_CRIT,
PASSIVE_DAMAGE
}
public AmplifierType Type { get; private set; }
public int Priortity { get; private set; }
public bool IsPassive { get; private set; }
public float Value => InitValue + IncreasePerLevel * Mathf.Clamp(Level - 1, 0, int.MaxValue);
public float InitValue { get; private set; }
public float IncreasePerLevel { get; private set; }
public int Level { get; private set; }
public int Price { get; private set; }
public int Chance { get; private set; }
public DamageAmplifier(AmplifierType type, int priority, bool isPassive,
float value, float increase, int price, int chance)
{
Type = type;
Priortity = priority;
IsPassive = isPassive;
InitValue = value;
IncreasePerLevel = increase;
Price = price;
Chance = chance;
}
public float CalculateDamage(float initDamage)
{
if (Level == 0)
return initDamage;
switch (Type)
{
case AmplifierType.PLUS_CLICK_DAMAGE:
case AmplifierType.PASSIVE_DAMAGE:
return initDamage + Value;
case AmplifierType.CLICK_CRIT:
if (Random.Range(0, 100) < Chance)
return initDamage * Value;
else
return initDamage;
default:
return initDamage;
}
}
public void LevelUp()
{
Level++;
}
}