Ejemplo n.º 1
0
 void Awake()
 {
     mask = -1;
     attr = GetComponent<UnitAttributes>();
     movement = GetComponent<UnitMovement>();
     animationManager = GetComponent<AnimationManager>();
 }
Ejemplo n.º 2
0
        protected void OutputForExperience(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");
                Print($"contact: {unitAttributes.ContactRadius}");
                Print($"xp: {unitAttributes.ExperienceValue}");

                // Experience Attributes
                ExperienceAttributes experience = entityTypeAttributes.Get <ExperienceAttributes>();
                if (experience != null)
                {
                    OutputForExperienceAttributes(experience);
                }
            }
        }
Ejemplo n.º 3
0
        protected void OutputForDPS(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            if (unitAttributes.WeaponLoadout.Length == 0 || !(unitSetting.weapons == null || unitSetting.weapons.Length > 0))
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");

                // Weapons
                OutputForWeapons(entityTypeCollection, entityTypeAttributes, unitSetting.weapons, true);
            }
        }
 /// <summary>
 /// Creates a player unit from a unit template.
 /// </summary>
 /// <param name="unitType"></param>
 /// <param name="attributes"></param>
 /// <param name="gridWidth"></param>
 /// <param name="gridHeight"></param>
 public CorePlayerUnit(PlayerUnitType unitType, UnitAttributes attributes, CorePlayer player, int gridWidth, int gridHeight)
     : base(EntityType.PlayerUnit, gridWidth, gridHeight)
 {
     UnitType    = unitType;
     Player      = player;
     _attributes = new UnitAttributes(attributes);
 }
 /// <summary>
 /// Creates a deep copy of a given set of attributes.
 /// </summary>
 /// <param name="copy">The set of attributes to copy from.</param>
 public UnitAttributes(UnitAttributes copy)
 {
     Hp    = copy.Hp;
     HpMax = copy.HpMax;
     AttackDamageDefault = copy.AttackDamageDefault;
     DefenseDefault      = copy.DefenseDefault;
 }
Ejemplo n.º 6
0
        protected void OutputForMovement(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            UnitMovementAttributes movement = entityTypeAttributes.Get <UnitMovementAttributes>();

            if (movement == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");

                OutputForMovementAttributes(movement, true);
            }
        }
Ejemplo n.º 7
0
 void Awake()
 {
     animationManager = GetComponent<AnimationManager>();
     attr = GetComponent<UnitAttributes>();
     movement = GetComponent<UnitMovement>();
     energyCost = 2;
 }
Ejemplo n.º 8
0
 void Awake()
 {
     player             = GetComponent <UnitAttributes>();
     facingIndicator    = transform.Find("FacingIndicator");
     portal1runningTime = portalCooldown;
     portal2runningTime = portalCooldown;
 }
Ejemplo n.º 9
0
 public void UnitAdd(UnitAttributes unit)
 {
     if (!UnitList.Contains(unit))
     {
         UnitList.Add(unit);
     }
 }
Ejemplo n.º 10
0
    // operations to manipulate the attributes

    // copy constructor
    public UnitAttributes(UnitAttributes other)
    {
        // turn it into unitbreed, not a monobehaviour but define externally
        maxLife     = other.maxLife;
        currentLife = other.currentLife;

        maxMana     = other.maxMana;
        currentMana = other.currentMana;

        attack = other.attack;
        armor  = other.armor;

        // capacities
        // Move
        isMoveCapacityAvailable = other.isMoveCapacityAvailable;
        moveBaseTimeCost        = other.moveBaseTimeCost;

        // Attack
        isAttackCapacityAvailable = other.isAttackCapacityAvailable;
        attackBaseTimeCost        = other.attackBaseTimeCost;

        // LaunchSpell
        isLaunchSpellCapacityAvailable = other.isLaunchSpellCapacityAvailable;
        launchSpellBaseTimeCost        = other.launchSpellBaseTimeCost;
    }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     attr      = GetComponent <UnitAttributes> () as UnitAttributes;
     ai        = GetComponent <NavMeshAI> () as NavMeshAI;
     attacking = false;
     hasEnemy  = true;
 }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     currentBufferTimer     = 0;
     currentHealthBuffer    = 0;
     timeToDisplayShield    = 0;
     isUpgraded             = false;
     shieldRenderer         = shieldObject.GetComponent <MeshRenderer>();
     shieldRenderer.enabled = false;
     if (mainEnemy == null)
     {
         //assign one.
         GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
         //In general I've found that the bosses tend to be at the end of the array, so we're going to start from the end
         //and then pick the first one that matches the criteria.
         for (int i = enemies.Length - 1; i >= 0; i++)
         {
             if (enemies[i].GetComponent <UnitAttributes>() != null)
             {
                 mainEnemy = enemies[i];
                 break;
             }
         }
         if (mainEnemy == null)              //still not found
         //just pick one.
         {
             mainEnemy = enemies[enemies.Length - 1];
         }
     }
     enemyAttributes = mainEnemy.GetComponent <UnitAttributes>();
     enemyMaxHealth  = enemyAttributes.CurrentHealth;
 }
 public static dynamic GetTSObject(UnitAttributes dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Ejemplo n.º 14
0
    // Use this for initialization

    void Start()
    {
        characterAnimator   = GetComponent <Animator> ();
        boxcollider         = GetComponent <BoxCollider2D>();
        currentDashDuration = dashDuration;
        unitAttributes      = GetComponent <UnitAttributes> ();
        dashBuff            = new DashBuff("Dash Invulnerability", dashDuration, null, false);
    }
Ejemplo n.º 15
0
 void Start()
 {
     gameManager = FindObjectOfType <GameManager> ();
     gameManager.allUnits.Add(this);
     turnManager = FindObjectOfType <TurnManager> ();
     turnManager.AddObject(this);
     transform.position = gameManager.walkableTileMap.GetCellCenterWorld(positionInGrid);
     currentAttributes  = new UnitAttributes(unitBreed);
 }
Ejemplo n.º 16
0
    private void Start()
    {
        animator   = GetComponent <Animator>();
        Attributes = GetComponent <UnitAttributes>();
        Mover      = GetComponent <ObjectMover>();

        MaxHealth = gameObject.GetComponent <UnitAttributes>().GetAttributeValue(Attribute.MaxHealth);
        Health    = MaxHealth;
    }
Ejemplo n.º 17
0
 void UpdateMP_HP_UI()
 {
     if (PlayerUnit != null)
     {
         UnitAttributes attr = PlayerUnit.attributes;
         Gamef.SetHP_UI_Rate(attr.SheildPoint / attr.MaxShieldPoint);
         Gamef.SetMP_UI_Rate(attr.ManaPoint.Value / attr.MaxManaPoint.Value);
     }
 }
Ejemplo n.º 18
0
    protected override void OnHitEnemy(GameObject hitObject)
    {
        // Gets the component (of the target hit) that controls the health,
        UnitAttributes targetAttributes = hitObject.GetComponent <UnitAttributes> ();

        // and deal damage to it
        targetAttributes.ApplyAttack(projectileDamage, projectileBuffs);

        // projectile dies
    }
Ejemplo n.º 19
0
        public void RefreshAttributes(UnitAttributes unitAttributes)
        {
            foreach (Category cat in this.categoryContentObject.items)
            {
                List <LevelRate> tempList = this.levelingRatesObject.allAttributes[cat.value];
                for (int i = 0; i < tempList.Count; i++)
                {
                    LevelRate rate = tempList[i];
                    if (!this.enablePlayerCustomEquations)
                    {
                        rate.isIncreasing = 0;
                    }
                    switch (cat.value)
                    {
                    default:
                        break;

                    case 0:
                        rate.rate = unitAttributes.healthPrefabList[i];
                        break;

                    case 1:
                        rate.rate = unitAttributes.attackPrefabList[i];
                        break;

                    case 2:
                        rate.rate = unitAttributes.attackCooldownPrefabList[i];
                        break;

                    case 3:
                        rate.rate = unitAttributes.speedPrefabList[i];
                        break;

                    case 4:
                        if (i == 0)
                        {
                            rate.rate = unitAttributes.splitPrefabFactor;
                        }
                        else
                        {
                            rate.rate = 0f;
                        }
                        break;

                    case 5:
                        rate.rate = unitAttributes.mergePrefabList[i];
                        break;
                    }
                    tempList[i] = rate;
                }
                this.levelingRatesObject.allAttributes[cat.value] = tempList;
            }
            this.levelingRatesObject.UpdateAllPanelItems(this.categoryContentObject.selectedToggle);
        }
Ejemplo n.º 20
0
    public void SetTarget(GameObject unit, Vector3 spawnPos)
    {
        targetUnit = unit;
        targetAttr = unit.GetComponent<UnitAttributes>();

        // Calculate velocity of projectile (from spawn point to target hit point)
        velocity = (targetAttr.hitPoint.position - spawnPos).normalized * speed;

        // Allow projectile to begin moving
        targetSet = true;
    }
Ejemplo n.º 21
0
 public void UnitRemove(UnitAttributes unit)
 {
     if (UnitList.Contains(unit))
     {
         UnitList.Remove(unit);
     }
     if (UnitList.Count == 0)
     {
         LevelManager.DM.EndScenario();
     }
 }
Ejemplo n.º 22
0
    public void BeginPhase()
    {
        ActionAvailable = true;
        ActionsMove     = true;

        UnitAttributes unit = this.GetComponent <UnitAttributes>();

        unit.isWaiting   = false;
        unit.isDefending = false;

        this.transform.GetChild(0).GetComponent <SpriteRenderer>().color = Color.white;
    }
Ejemplo n.º 23
0
 private void Init(EventMgr.UnitBirthEventInfo info)
 {
     if (isInit)
     {
         return;
     }
     if (info.Unit.gameObject != gameObject)
     {
         return;
     }
     unit           = info.Unit;
     unitAttributes = unit.attributes;
     rigbody        = unit.rigbody;
     isInit         = true;
 }
Ejemplo n.º 24
0
 public UnitAttributesWrapper(UnitAttributes other) : base(other.Name)
 {
     Class                          = other.Class;
     SelectionFlags                 = other.SelectionFlags;
     NavMeshAttributes              = other.NavMeshAttributes;
     MaxHealth                      = other.MaxHealth;
     Armour                         = other.Armour;
     DamageReceivedMultiplier       = other.DamageReceivedMultiplier;
     AccuracyReceivedMultiplier     = other.AccuracyReceivedMultiplier;
     PopCapCost                     = other.PopCapCost;
     ExperienceValue                = other.ExperienceValue;
     ProductionTime                 = other.ProductionTime;
     AggroRange                     = other.AggroRange;
     LeashRange                     = other.LeashRange;
     AlertRange                     = other.AlertRange;
     RepairPickupRange              = other.RepairPickupRange;
     UnitPositionReaggroConditions  = other.UnitPositionReaggroConditions;
     LeashPositionReaggroConditions = other.LeashPositionReaggroConditions;
     LeadPriority                   = other.LeadPriority;
     Selectable                     = other.Selectable;
     Controllable                   = other.Controllable;
     Targetable                     = other.Targetable;
     NonAutoTargetable              = other.NonAutoTargetable;
     RetireTargetable               = other.RetireTargetable;
     HackedReturnTargetable         = other.HackedReturnTargetable;
     HackableProperties             = other.HackableProperties;
     ExcludeFromUnitStats           = other.ExcludeFromUnitStats;
     BlocksLOF                      = other.BlocksLOF;
     WorldHeightOffset              = other.WorldHeightOffset;
     DoNotPersist                   = other.DoNotPersist;
     LevelBound                     = other.LevelBound;
     StartsInHangar                 = other.StartsInHangar;
     SensorRadius                   = other.SensorRadius;
     ContactRadius                  = other.ContactRadius;
     NumProductionQueues            = other.NumProductionQueues;
     ProductionQueueDepth           = other.ProductionQueueDepth;
     ShowProductionQueues           = other.ShowProductionQueues;
     NoTextNotifications            = other.NoTextNotifications;
     NotificationFlags              = other.NotificationFlags;
     FireRateDisplay                = other.FireRateDisplay;
     WeaponLoadout                  = other.WeaponLoadout?.ToArray();
     PriorityAsTarget               = other.PriorityAsTarget;
     ThreatData                     = other.ThreatData;
     ThreatCounters                 = other.ThreatCounters;
     ThreatCounteredBys             = other.ThreatCounteredBys;
     Resource1Cost                  = other.Resource1Cost;
     Resource2Cost                  = other.Resource2Cost;
 }
Ejemplo n.º 25
0
    public void AttackPhase(GameObject target)
    {
        //Range Check Code

        //Combat Check

        //This Unit's attacking power
        UnitAttributes OffUnitAttributes = this.GetComponent <UnitAttributes>();
        float          OffensiveUnitDef  = OffUnitAttributes.EffectiveDefenceReturn();
        float          OffensiveUnitAtt  = OffUnitAttributes.EffectiveAttackReturn();
        //The target unit's attacking power


        UnitAttributes TarUnitAttributes = target.GetComponent <UnitAttributes>();
        float          DefendingUnitDef  = TarUnitAttributes.EffectiveDefenceReturn();

        if (TarUnitAttributes.isDefending)
        {
            //Calculate Starting Attack (before it takes damage)
            float DefendingUnitAtt = TarUnitAttributes.EffectiveAttackReturn();
            TarUnitAttributes.HealthPool -= TarUnitAttributes.DamageReturn(OffensiveUnitAtt, DefendingUnitDef, OffUnitAttributes);
            OffUnitAttributes.HealthPool -= OffUnitAttributes.DamageReturn(DefendingUnitAtt, OffensiveUnitDef, TarUnitAttributes);
        }
        else
        {
            //Phase 1
            TarUnitAttributes.HealthPool -= TarUnitAttributes.DamageReturn(OffensiveUnitAtt, DefendingUnitDef, OffUnitAttributes);
            //Phase 2
            if (TarUnitAttributes.HealthPool > 0)
            {
                float DefendingUnitAtt = TarUnitAttributes.EffectiveAttackReturn();
                OffUnitAttributes.HealthPool -= OffUnitAttributes.DamageReturn(DefendingUnitAtt, OffensiveUnitDef, TarUnitAttributes);
            }
            else
            {
                Destroy(TarUnitAttributes.gameObject);
            }
        }
        if (OffUnitAttributes.HealthPool <= 0)
        {
            Destroy(OffUnitAttributes.gameObject);
        }
        if (TarUnitAttributes.HealthPool <= 0)
        {
            Destroy(TarUnitAttributes.gameObject);
        }
        EndPhase();
    }
Ejemplo n.º 26
0
 void OnTriggerStay2D(Collider2D other)
 {
     Debug.Log("MAMAMAMAMA");
     if (other.gameObject.layer == LayerMask.NameToLayer("Player") && other.gameObject.activeInHierarchy)
     {
         count -= Time.deltaTime;
         Debug.Log(count);
         if (count <= 0)
         {
             UnitAttributes healObj = deadObject.GetComponent <UnitAttributes> ();
             healObj.Respawn();
             healObj.gameObject.SetActive(true);
             Destroy(this.gameObject);
         }
     }
 }
Ejemplo n.º 27
0
        protected void OutputForGeneral(EntityTypeCollection entityTypeCollection, EntityTypeAttributes entityTypeAttributes, StatsSheetSettings.UnitSetting unitSetting = null)
        {
            UnitAttributes unitAttributes = entityTypeAttributes.Get <UnitAttributes>();

            if (unitAttributes == null)
            {
                return;
            }

            using (BeginScope(entityTypeAttributes.Name))
            {
                // Unit Attributes
                Print($"readableName: {unitSetting.readableName}");
                Print($"cu: {unitAttributes.Resource1Cost}");
                Print($"ru: {unitAttributes.Resource2Cost}");
                Print($"time: {unitAttributes.ProductionTime}");
                Print($"pop: {unitAttributes.PopCapCost}");
                Print($"hp: {unitAttributes.MaxHealth}");
                Print($"armor: {unitAttributes.Armour}");
                Print($"sensor: {unitAttributes.SensorRadius}");
                Print($"contact: {unitAttributes.ContactRadius}");
                Print($"xp: {unitAttributes.ExperienceValue}");
                Print($"priorityAsTarget: {unitAttributes.PriorityAsTarget}");

                // Movement Attributes
                UnitMovementAttributes movement = entityTypeAttributes.Get <UnitMovementAttributes>();
                if (movement != null)
                {
                    OutputForMovementAttributes(movement);
                }

                // Harvester Attributes
                HarvesterAttributes harvester = entityTypeAttributes.Get <HarvesterAttributes>();
                if (harvester != null)
                {
                    OutputForHarvesterAttributes(harvester);
                }

                // Weapons
                if (unitAttributes.WeaponLoadout.Length > 0 && (unitSetting.weapons == null || unitSetting.weapons.Length > 0))
                {
                    OutputForWeapons(entityTypeCollection, entityTypeAttributes, unitSetting.weapons);
                }
            }
        }
Ejemplo n.º 28
0
 public void FetchUnitAttributes()
 {
     GameObject[] objs = GameObject.FindGameObjectsWithTag("UnitAttributes");
     for (int i = 0; i < objs.Length; i++)
     {
         UnitAttributes unitAttribute = objs[i].GetComponent <UnitAttributes>();
         if (unitAttribute != null)
         {
             NetworkIdentity identity = unitAttribute.GetComponent <NetworkIdentity>();
             if (identity != null && identity.hasAuthority)
             {
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.Health);
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.Attack);
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.AttackCooldown);
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.Speed);
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.Split);
                 this.attributes.UpdateOnlineAttributes(unitAttribute, AttributeProperty.Merge);
             }
         }
     }
 }
Ejemplo n.º 29
0
    //Dictionary<ItemID,Label> _items = new Dictionary<ItemID,Label>();

    public override void _Ready()
    {
        _healthbar_progress = (TextureProgress)FindNode("healthbar_progress");
        _healthbar_label    = (Label)FindNode("healthbar_label");

        _experiencebar_progress = (TextureProgress)FindNode("experiencebar");

        _level_label = (Label)FindNode("level_label");

        _coins_label = (Label)GetNode("coins_label");

        Label l1 = (Label)FindNode("skill1_label");
        Label l2 = (Label)FindNode("skill2_label");
        Label l3 = (Label)FindNode("skill3_label");
        Label l4 = (Label)FindNode("skill4_label");

        _skill_labels = new Label[4] {
            l1, l2, l3, l4
        };
        foreach (Label l in _skill_labels)
        {
            l.Hide();
        }

        BasePlayer player = (BasePlayer)GetTree().GetNodesInGroup("player")[0];   // probably should add a check for this

        UnitAttributes a = player.Attributes;

        OnHealthChanged(a.Health, a.MaxHealth);
        OnExperienceUp(a.Experience, a.NextLevelExperience);
        OnLevelUp(a.Level);
        OnCoinsChanged(a.Coins);

        player.LevelChangedEvent         += OnLevelUp;
        player.ExperienceChangedEvent    += OnExperienceUp;
        player.HealthChangedEvent        += OnHealthChanged;
        player.CoinsChangedEvent         += OnCoinsChanged;
        player.SkillCooldownChangedEvent += OnSkillCooldownChanged;
        //player.ItemCollectedEvent += OnItemCollectedEvent;
    }
Ejemplo n.º 30
0
    private void PreUnitAttributesInitialization()
    {
        GameObject obj = GameObject.Find("Temporary Unit Attributes");

        if (obj == null)
        {
            obj = this.temporaryUnitAttributesObject;
        }
        if (obj != null)
        {
            UnitAttributes myAttributes         = null;
            GameObject[]   playerUnitAttributes = GameObject.FindGameObjectsWithTag("UnitAttributes");
            for (int i = 0; i < playerUnitAttributes.Length; i++)
            {
                NetworkIdentity identity = playerUnitAttributes[i].GetComponent <NetworkIdentity>();
                if (identity.hasAuthority)
                {
                    myAttributes = playerUnitAttributes[i].GetComponent <UnitAttributes>();
                    UnitAttributes tempAttr = obj.GetComponent <UnitAttributes>();
                    myAttributes.CopyFrom(tempAttr);
                    break;
                }
            }
            if (myAttributes != null)
            {
                GameObject[] gameUnits = GameObject.FindGameObjectsWithTag("Unit");
                foreach (GameObject unit in gameUnits)
                {
                    NetworkIdentity identity = unit.GetComponent <NetworkIdentity>();
                    if (identity != null && identity.hasAuthority)
                    {
                        GameUnit gameUnit = unit.GetComponent <GameUnit>();
                        gameUnit.unitAttributes = myAttributes;
                    }
                }
            }
            GameMetricLogger.SetGameLogger(GameLoggerOptions.GameIsPlaying);
        }
    }
Ejemplo n.º 31
0
    public int DamageReturn(float AStrength, float DStrength, UnitAttributes Aggressor)
    {
        //AStrength and DStrength are the values pushed through to account simultanious attack
        //AStrength and DStrength is the calculated before it's pulled, factored weakness mod
        //Values fed are either their return current values, or held values from GM.

        if (isDefending)
        {
            DStrength = DStrength * 1.25f;
        }
        if (CommandPower != 0)
        {
            DStrength = DStrength * (1 + (CommandPower / 100));
        }

        if (GameManager.GManager.Gameplay_Unit_Fatigue_isEnabled)
        {
            if (Fatigue)
            {
                DStrength = DStrength * 0.9f;
            }
        }
        if (GameManager.GManager.Gameplay_Unit_Morale_isEnabled)
        {
            if (Morale < 1)
            {
                DStrength = DStrength * 0.9f;
            }
            else if (Morale == 1)
            {
                DStrength = DStrength * 1f;
            }
            else if (Morale > 1)
            {
                DStrength = DStrength * 1.1f;
            }
        }
        if (GameManager.GManager.Gameplay_Unit_Ranks_isEnabled)
        {
            if (Morale < 1)
            {
                DStrength = DStrength * 1.1f;
            }
            else if (Morale == 1)
            {
                DStrength = DStrength * 1.2f;
            }
            else if (Morale > 1)
            {
                DStrength = DStrength * 1.25f;
            }
        }
        if (GameManager.GManager.Gameplay_Unit_Inflictions_isEnabled)
        {
            switch (Infliction)
            {
            case 1:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Sick * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 2:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Intoxicated * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 3:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Cold * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 4:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Frozen * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 5:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Sweating * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 6:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Sunstroke * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 7:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Poisoned * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            case 8:
                DStrength += DStrength * (GameManager.GManager.Gameplay_Unit_Inflictions_Delirious * GameManager.GManager.Gameplay_Unit_Inflictions_Severity);
                break;

            default:
                break;
            }
        }
        if (Aggressor.Anti_ArmourType1 && Def_ArmourType1)
        {
            AStrength = AStrength * 1.35f;
        }
        if (Aggressor.Anti_ArmourType2 && Def_ArmourType2)
        {
            AStrength = AStrength * 1.35f;
        }
        if (Aggressor.Anti_ArmourType3 && Def_ArmourType3)
        {
            AStrength = AStrength * 1.35f;
        }
        if (Aggressor.Anti_ArmourType4 && Def_ArmourType4)
        {
            AStrength = AStrength * 1.35f;
        }
        if (Aggressor.Anti_ArmourType5 && Def_ArmourType5)
        {
            AStrength = AStrength * 1.35f;
        }

        //Modifier Stack
        float DamageValue = 50 * (Mathf.Pow(AStrength / DStrength, 0.366f));

        return(Mathf.FloorToInt(DamageValue));
    }
Ejemplo n.º 32
0
 public override void SetAttributes(UnitAttributes attributes)
 {
     this.unitAttr = attributes;
 }
Ejemplo n.º 33
0
    public void UpdateOnlineAttributes(UnitAttributes unitAttributes, AttributeProperty property)
    {
        float previousAnswer = 0f;
        for (int level = 0; level < MAX_NUM_OF_LEVELS; level++) {
            float answer = (float)MathParser.ProcessEquation(this.equationInputField.text, property, level + 1, level, previousAnswer);
            previousAnswer = answer;

            if (this.debugFlag) {
                Debug.Log("DEBUG 8");
            }

            GameObject panel = this.prefabList[level];
            Title titlePanel = panel.GetComponentInChildren<Title>();

            if (this.debugFlag) {
                Debug.Log("DEBUG 9");
            }

            if (titlePanel != null) {
                titlePanel.titleText.text = "Level " + (level + 1).ToString();
            }

            if (this.debugFlag) {
                Debug.Log("DEBUG 10");
            }

            int propertyValue = 0;
            Number numberPanel = panel.GetComponentInChildren<Number>();
            if (numberPanel != null) {
                if (this.unitAttributes != null) {
                    switch (property) {
                        case AttributeProperty.Health:
                            unitAttributes.healthPrefabList[level] = answer;
                            numberPanel.numberText.text = answer.ToString();
                            propertyValue = 0;
                            break;
                        case AttributeProperty.Attack:
                            unitAttributes.attackPrefabList[level] = answer;
                            numberPanel.numberText.text = answer.ToString();
                            propertyValue = 1;
                            break;
                        case AttributeProperty.Speed:
                            unitAttributes.speedPrefabList[level] = answer;
                            numberPanel.numberText.text = answer.ToString();
                            propertyValue = 2;
                            break;
                        case AttributeProperty.Merge:
                            unitAttributes.mergePrefabList[level] = answer;
                            numberPanel.numberText.text = answer.ToString();
                            propertyValue = 3;
                            break;
                        case AttributeProperty.AttackCooldown:
                            unitAttributes.attackCooldownPrefabList[level] = answer;
                            numberPanel.numberText.text = answer.ToString();
                            propertyValue = 4;
                            break;
                        case AttributeProperty.Split:
                            if (level <= 0) {
                                unitAttributes.splitPrefabFactor = answer;
                                numberPanel.numberText.text = answer.ToString();
                            }
                            else {
                                numberPanel.numberText.text = "N/A";
                            }
                            level = 10;
                            propertyValue = 5;
                            break;
                        default:
                        case AttributeProperty.Invalid:
                            throw new ArgumentException("Attribute property is invalid.");
                    }
                }
            }

            if (this.debugFlag) {
                Debug.Log("DEBUG 11");
            }

            unitAttributes.CmdUpdateAnswer(answer, level, propertyValue);

            if (this.debugFlag) {
                Debug.Log("DEBUG 12");
            }
        }
    }
Ejemplo n.º 34
0
        public void SetAttributes()
        {
            DropdownFix[] fixes  = GameObject.FindObjectsOfType <DropdownFix>();
            int           values = 0;

            for (int i = 0; i < fixes.Length; i++)
            {
                values += fixes[i].value;
            }
            if (values <= 0)
            {
                //TODO(Thompson): Need to create some sort of message box alerting the player to set the player presets first.
                return;
            }

            if (this.unitAttributes == null)
            {
                GameObject obj = GameObject.FindGameObjectWithTag("UnitAttributes");
                if (obj != null)
                {
                    this.unitAttributes = obj.GetComponent <UnitAttributes>();
                }
            }
            if (this.unitAttributes != null && this.dropdown != null && this.attributePanelUI != null)
            {
                //TODO: Make complex presets.
                int itemValue = this.dropdown.value;
                switch (itemValue)
                {
                default:
                case 0:
                    string zero1 = "y=0";
                    unitAttributes.SetHealthAttributes(zero1);
                    unitAttributes.SetAttackAttributes(zero1);
                    unitAttributes.SetSpeedAttributes(zero1);
                    unitAttributes.SetSplitAttributes(zero1);
                    unitAttributes.SetMergeAttributes(zero1);
                    unitAttributes.SetAttackCooldownAttributes(zero1);
                    this.attributePanelUI.DisableCustomEquations();
                    break;

                case 1:
                case 2:
                case 3:
                    Debug.Log("Setting expression: " + this.dropdown.options[itemValue].text);
                    string expression = this.dropdown.options[itemValue].text;
                    unitAttributes.SetHealthAttributes(expression);
                    unitAttributes.SetAttackAttributes(expression);
                    unitAttributes.SetSpeedAttributes(expression);
                    unitAttributes.SetSplitAttributes(expression);
                    unitAttributes.SetMergeAttributes(expression);
                    unitAttributes.SetAttackCooldownAttributes(expression);
                    this.attributePanelUI.DisableCustomEquations();
                    break;

                case 4:
                    unitAttributes.SetHealthAttributes("y=2*x");
                    string otherExpression = "y=1.414*x";
                    unitAttributes.SetAttackAttributes(otherExpression);
                    unitAttributes.SetSpeedAttributes(otherExpression);
                    unitAttributes.SetSplitAttributes(otherExpression);
                    unitAttributes.SetMergeAttributes(otherExpression);
                    unitAttributes.SetAttackCooldownAttributes(otherExpression);
                    this.attributePanelUI.DisableCustomEquations();
                    break;

                case 5:
                    string one = "y=1";
                    unitAttributes.SetHealthAttributes(one);
                    unitAttributes.SetAttackAttributes(one);
                    unitAttributes.SetSpeedAttributes(one);
                    unitAttributes.SetSplitAttributes(one);
                    unitAttributes.SetMergeAttributes(one);
                    unitAttributes.SetAttackCooldownAttributes(one);
                    this.attributePanelUI.EnableCustomEquations();
                    break;
                }
                this.attributePanelUI.RefreshAttributes(this.unitAttributes);
            }
        }
Ejemplo n.º 35
0
 void Awake()
 {
     attr = GetComponent<UnitAttributes>();
     ability = GetComponent<Ability>();
 }
 /// <summary>
 /// Creates a player unit from a copy of another unit.
 /// Use this in the client code to initialise unit fields properly.
 /// </summary>
 /// <param name="copy"></param>
 public CorePlayerUnit(CorePlayerUnit copy) : base(copy)
 {
     UnitType    = copy.UnitType;
     Player      = copy.Player;
     _attributes = new UnitAttributes(copy._attributes);
 }
Ejemplo n.º 37
0
 void Awake()
 {
     navComponent = GetComponent<NavMeshAgent>();
     attr = GetComponent<UnitAttributes>();
     animationManager = GetComponent<AnimationManager>();
 }
Ejemplo n.º 38
0
 void Awake()
 {
     animationManager = GetComponent<AnimationManager>();
     attr = GetComponent<UnitAttributes>();
 }
Ejemplo n.º 39
0
 public abstract void SetAttributes(UnitAttributes attributes);
Ejemplo n.º 40
0
 void Awake()
 {
     gameManager = GameObject.Find ("GameManager").GetComponent<GameManager>();
     attr = GetComponent<UnitAttributes>();
 }
Ejemplo n.º 41
0
    void Awake()
    {
        anim = GetComponent<Animation>();
        attr = GetComponent<UnitAttributes>();
        gameManager = GameObject.Find ("GameManager").GetComponent<GameManager>();

        if (idleAnimation != "")
        {
            anim.Play(idleAnimation);
        }
    }