示例#1
0
    public void RestartClick()
    {
        if (_currentCoins < _necessaryCoinsToRestart)
        {
            return;
        }

        _originalAvaliableAttributePoints = _currentAvaliableAttributePoints +
                                            (_currentAttributePoints.Health - PlayerInfo.DefaultHealth) +
                                            (_currentAttributePoints.Air - PlayerInfo.DefaultAir) +
                                            (_currentAttributePoints.Earth - PlayerInfo.DefaultEarth) +
                                            (_currentAttributePoints.Fire - PlayerInfo.DefaultFire) +
                                            (_currentAttributePoints.Water - PlayerInfo.DefaultWater) +
                                            (_currentAttributePoints.Light - PlayerInfo.DefaultLight);
        _currentAvaliableAttributePoints = _originalAvaliableAttributePoints;

        _originalAttributePoints          = PlayerInfo.DefaultAttributePoints();
        _originalAvaliableAttributePoints = PlayerInfo.DefaultAvaliableAttributePoints;
        _originalCoins -= _necessaryCoinsToRestart;

        _currentAttributePoints          = PlayerInfo.DefaultAttributePoints();
        _currentAvaliableAttributePoints = PlayerInfo.DefaultAvaliableAttributePoints;
        _currentCoins -= _necessaryCoinsToRestart;

        SetupComponents();
    }
示例#2
0
 public void Initialize(int healthAmount, AttributePoints attributePoints, Character target)
 {
     OriginPosition = transform.position;
     Health.Initialize(healthAmount);
     AttributePoints = attributePoints;
     Target          = target;
 }
示例#3
0
    private static AttributePoints DistributeAttributePoints(int points)
    {
        var attributePoints = new AttributePoints
        {
            Air = 1, Earth = 1, Fire = 1, Health = 1, Light = 1, Water = 1
        };

        var pointsToDistribute = points;
        var enumAttributes     = Enum.GetValues(typeof(AttributeType));
        var pointsPerAttribute = (int)Mathf.Ceil(points / enumAttributes.Length);

        pointsPerAttribute = pointsPerAttribute > 0 ? pointsPerAttribute : 1;
        while (pointsToDistribute > 0)
        {
            var indexAttributeType = Random.Range(0, 5);
            var nameAttribute      = enumAttributes.GetValue(indexAttributeType).ToString();
            var element            = attributePoints.GetType().GetField(nameAttribute);
            if (element == null)
            {
                throw new Exception(string.Format("Não foi possivel localizar o elemento de nome {0} para atribuir os pontos do BOSS.", nameAttribute));
            }
            element.SetValue(attributePoints, pointsPerAttribute);
            pointsToDistribute -= pointsPerAttribute;
        }

        return(attributePoints);
    }
示例#4
0
    private static ISpell CreateTimeSpell(GameObject prefabSpell, Sprite sprite, AttributePoints playerAttributes)
    {
        var spell = prefabSpell.AddComponent <TimeSpell>();
        var time  = (int)Math.Floor((decimal)((playerAttributes.Light + playerAttributes.Air) / 2));

        spell.Initialize(time, sprite);
        return(spell);
    }
示例#5
0
    private static IStatus CreateRootingStatus(AttributePoints playerAttributes)
    {
        var statusPrefab = CreateStatusPrefab();
        var status       = statusPrefab.AddComponent <RootingStatus>();

        status.Initialize((int)Math.Floor((decimal)((playerAttributes.Water + playerAttributes.Earth) / 2)));

        return(status);
    }
示例#6
0
    private static IStatus CreateBurnStatus(AttributePoints playerAttributes)
    {
        var statusPrefab = CreateStatusPrefab();
        var status       = statusPrefab.AddComponent <BurnStatus>();

        status.Initialize((int)Math.Ceiling((decimal)(playerAttributes.Fire / 2)), (int)Math.Ceiling((decimal)(playerAttributes.Fire / 2)));

        return(status);
    }
示例#7
0
    public void LoadData()
    {
        _originalAttributePoints          = PlayerInfo.AttributePoints;
        _originalAvaliableAttributePoints = PlayerInfo.AvaliableAttributePoints;
        _originalCoins = PlayerInfo.Coins;

        _currentAttributePoints          = PlayerInfo.AttributePoints;
        _currentAvaliableAttributePoints = PlayerInfo.AvaliableAttributePoints;
        _currentCoins = PlayerInfo.Coins;
    }
示例#8
0
 public void Create(Sprite sprite, int force, Character origin, Character target, bool critical, AttributePoints attributePoints)
 {
     Type            = CreateSpellType.Attack;
     Sprite          = sprite;
     Force           = force;
     Origin          = origin;
     Target          = target;
     Critical        = critical;
     AttributePoints = attributePoints;
 }
示例#9
0
    private static int CalculateSpellForce(List <Runa> selectedRunas, AttributePoints playerAttributes)
    {
        EnumElement element = selectedRunas[0].Element;

        int elementForce = 0;

        if (element == EnumElement.Air)
        {
            elementForce = playerAttributes.Air;
        }
        else if (element == EnumElement.Earth)
        {
            elementForce = playerAttributes.Earth;
        }
        else if (element == EnumElement.Fire)
        {
            elementForce = playerAttributes.Fire;
        }
        else if (element == EnumElement.Light)
        {
            elementForce = playerAttributes.Light;
        }
        else if (element == EnumElement.Water)
        {
            elementForce = playerAttributes.Water;
        }

        var force = 0;

        var runasBuff   = selectedRunas.Count(x => x.PoweredUp);
        var runasNormal = selectedRunas.Count(x => !x.PoweredUp);

        force = (int)(elementForce * (runasBuff * 5) * 1.5) + (elementForce * runasNormal * 5);

        return(force);
    }
示例#10
0
    public static ISpell Create(EnumElement element, EnumElement?elementLastRuna, List <Runa> selectedRunas, Character origin, Character target, AttributePoints attributes)
    {
        EnumElement element1 = element;
        EnumElement?element2 = elementLastRuna;

        var prefabSpell = CreateSpellPrefab();

        var force = CalculateSpellForce(selectedRunas, attributes);

        switch (element1)
        {
        case EnumElement.Air:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, true));

            case EnumElement.Earth:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, false));

            case EnumElement.Fire:
                return(CreateBurnSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/BurnSpell"), force, attributes, origin, target));

            case EnumElement.Water:
                return(CreateFreezeTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FreezeSpell"), attributes));

            case EnumElement.Light:
                return(CreateTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AddTimeSpell"), attributes));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AirSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Earth:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, false));

            case EnumElement.Earth:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, true));

            case EnumElement.Fire:
                return(CreateLavaSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LavaSpell"), force, attributes, origin, target));

            case EnumElement.Water:
                return(CreateRootingSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/RootingSpell"), force, attributes, origin, target));

            case EnumElement.Light:
                return(CreateProtectionSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ProtectionSpell"), force, attributes, origin, target));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/EarthSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Fire:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateBurnSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/BurnSpell"), force, attributes, origin, target));

            case EnumElement.Earth:
                return(CreateLavaSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LavaSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, true));

            case EnumElement.Water:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, false));

            case EnumElement.Light:
                return(CreateClearStatusSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ClearStatusSpell"), origin));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FireSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Water:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateFreezeTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/FreezeSpell"), attributes));

            case EnumElement.Earth:
                return(CreateRootingSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/RootingSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, false));

            case EnumElement.Water:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, true));

            case EnumElement.Light:
                return(CreateHealthSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/CureSpell"), force, attributes, origin));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/WaterSpell"), force, origin, target, false));

            default:
                return(null);
            }

        case EnumElement.Light:
            switch (element2)
            {
            case EnumElement.Air:
                return(CreateTimeSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/AddTimeSpell"), attributes));

            case EnumElement.Earth:
                return(CreateProtectionSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ProtectionSpell"), force, attributes, origin, target));

            case EnumElement.Fire:
                return(CreateClearStatusSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/ClearStatusSpell"), origin));

            case EnumElement.Water:
                return(CreateHealthSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/CureSpell"), force, attributes, origin));

            case EnumElement.Light:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LightSpell"), force, origin, target, false));

            case null:
                return(CreateAttackSpell(prefabSpell, CustomResources.Load <Sprite>("Spells/LightSpell"), force, origin, target, false));

            default:
                return(null);
            }

        default:
            return(null);
        }
    }
示例#11
0
    private static ISpell CreateProtectionSpell(GameObject prefabSpell, Sprite sprite, int force, AttributePoints playerAttributes, Character origin, Character target)
    {
        var spell = prefabSpell.AddComponent <ProtectionSpell>();

        spell.Initialize(force, sprite, origin, target);
        return(spell);
    }
示例#12
0
    private static ISpell CreateHealthSpell(GameObject prefabSpell, Sprite sprite, int force, AttributePoints playerAttributes, Character origin)
    {
        var spell = prefabSpell.AddComponent <HealthSpell>();

        spell.Initialize(sprite, (int)Math.Floor((decimal)(force / 2)), (int)Math.Floor((decimal)((playerAttributes.Light + playerAttributes.Water) / 2)), origin);
        return(spell);
    }
示例#13
0
    private static ISpell CreateRootingSpell(GameObject prefabSpell, Sprite sprite, int force, AttributePoints playerAttributes, Character origin, Character target)
    {
        var spell  = prefabSpell.AddComponent <AttackSpell>();
        var status = CreateRootingStatus(playerAttributes);

        spell.Initialize(force, origin, target, false, status, sprite);

        return(spell);
    }
示例#14
0
 public void Initialize(int healthAmount, AttributePoints attributePoints, Character target, int maxPower)
 {
     base.Initialize(healthAmount, attributePoints, target);
     this.MaxPower = maxPower;
 }