Exemple #1
0
        public override int GetHashCode()
        {
            int result = 7057;

            result = result * 8171 + InternalFlags;
            result = result * 8171 + DontObstructDistance.GetHashCode();
            result = result * 8171 + DontPlayDistance.GetHashCode();
            result = result * 8171 + AttackDistance.GetHashCode();
            result = result * 8171 + MinDistance.GetHashCode();
            result = result * 8171 + SustainBeginDistance.GetHashCode();
            result = result * 8171 + SustainEndDistance.GetHashCode();
            result = result * 8171 + MaxDistance.GetHashCode();
            result = result * 8171 + SustainDB.GetHashCode();
            result = result * 8171 + SkipFraction.GetHashCode();
            result = result * 8171 + MaxPendPerSec.GetHashCode();
            result = result * 8171 + GainBase.GetHashCode();
            result = result * 8171 + GainVariance.GetHashCode();
            result = result * 8171 + RandomPitchBoundsMin;
            result = result * 8171 + RandomPitchBoundsMax;
            result = result * 8171 + InnerConeAngle.GetHashCode();
            result = result * 8171 + OuterConeAngle.GetHashCode();
            result = result * 8171 + OuterConeGain.GetHashCode();
            result = result * 8171 + Flags;
            result = result * 8171 + Azimuth.GetHashCode();
            result = result * 8171 + PositionalGain.GetHashCode();
            result = result * 8171 + FirstPersonGain.GetHashCode();
            return(result);
        }
Exemple #2
0
	protected Attack(int currentActionInt, string attackName, float coolDown, float duration, AttackType attackType, AttackDistance attackDist, DamageType damageType, float minHit, float maxHit) {
		this.currentActionInt 	= currentActionInt;
		this.name 				= attackName;
		this.cooldown 			= coolDown;
		this.duration 			= duration;
		this.attackType			= attackType;
		this.distance 			= attackDist;
		this.damageType 		= damageType;
		this.minHit 			= minHit;
		this.maxHit 			= maxHit;
	}
Exemple #3
0
	protected Attack() {
		currentActionInt	= int.MaxValue;
		name 				= "Unnamed Attack";
		cooldown 			= float.MaxValue;
		duration 			= float.MaxValue;
		attackType 			= AttackType.Damage;
		distance 			= AttackDistance.Melee;
		damageType 			= DamageType.Melee;
		minHit 				= 0f;
		maxHit 				= 0f;
	}
        public override int GetHashCode()
        {
            int result = 7057;

            result = result * 8171 + DontObstructDistance.GetHashCode();
            result = result * 8171 + DontPlayDistance.GetHashCode();
            result = result * 8171 + AttackDistance.GetHashCode();
            result = result * 8171 + MinDistance.GetHashCode();
            result = result * 8171 + SustainBeginDistance.GetHashCode();
            result = result * 8171 + SustainEndDistance.GetHashCode();
            result = result * 8171 + MaxDistance.GetHashCode();
            result = result * 8171 + SustainDB.GetHashCode();
            return(result);
        }
Exemple #5
0
 private void StartAttack()
 {
     aiStatus = AIStatus.attack;
     switch (Parameters.AttackType)
     {
         case AttackType.hitAndRun:
             Action = new AttackHitAndRun(this, MainController.Instance.level.MainHero, StartAttack);
             break;
         case AttackType.distanceFight:
             Action = new AttackDistance(this, MainController.Instance.level.MainHero, StartAttack);
             break;
         case AttackType.closeCombat:
             Action = new AttackCloseCombat(this, MainController.Instance.level.MainHero, StartAttack);
             break;
     }
 }
Exemple #6
0
 void StartCameraMoveUseiTween(Vector3 pos, AttackDistance distance)
 {
     iTween.MoveTo(gameObject, iTween.Hash("x", pos.x + attackCamera[(int)distance].position.x, "y", pos.y + attackCamera[(int)distance].position.y, "z", pos.z + attackCamera[(int)distance].position.z,
                                           "time", changeTime, "oncomplete", "OnCompleteMove", "oncompletetarget", gameObject, "oncompleteparams", CameraState.Attack));
     iTween.RotateTo(gameObject, iTween.Hash("x", attackCamera[(int)distance].rotation.x, "y", GetInverseRotationFromFrontMode() + attackCamera[(int)distance].rotation.y, "z", attackCamera[(int)distance].rotation.z, "time", changeTime, "islocal", true));
 }
Exemple #7
0
 protected virtual void StartAttack(bool byHit)
 {
     var heroTarget = MainController.Instance.level.MainHero;
     if (heroTarget == null)
     {
         return;
     }
     aiStatus = AIStatus.attack;
     switch (Parameters.AttackType)
     {
         case AttackType.distanceFight:
             Action = new AttackDistance(this, heroTarget, EndAttack, byHit);
             break;
         case AttackType.closeCombat:
             Action = new AttackCloseCombat(this, heroTarget, EndAttack, byHit);
             break;
     }
 }
        private void InstantiateCharacters(int entityCount)
        {
            if (entityCount <= 0)
            {
                return;
            }

            var entityArray = new NativeArray <Entity>(entityCount, Allocator.TempJob);

            EntityManager.CreateEntity(m_Archetype, entityArray);

            var terrain = Terrain.activeTerrain;

            for (var entityIndex = 0; entityIndex < entityArray.Length; entityIndex++)
            {
                var type                  = (ViewType)m_Random.NextInt(Enum.GetValues(typeof(ViewType)).Length);
                var entity                = entityArray[entityIndex];
                var movementSpeed         = new MovementSpeed();
                var rotationSpeed         = new RotationSpeed();
                var rotationSpeedModifier = new RotationSpeedModifier();
                var walkSpeedModifier     = new WalkSpeedModifier();
                var chargeSpeedModifier   = new ChargeSpeedModifier();
                var engageSqrRadius       = new EngageSqrRadius();
                var attackDistance        = new AttackDistance {
                    Min = 1.5f, Max = 2
                };
                var attackAnimationDuration = new AttackAnimationDuration();
                var attackDamage            = new AttackDamage();
                var attackSpeed             = new AttackSpeed();
                var maxHealth          = new MaxHealth();
                var health             = new Health();
                var healthRegeneration = new HealthRegeneration();
                var viewInfo           = new ViewInfo();

                PostUpdateCommands.SetComponent(entity, new Translation {
                    Value = terrain.GetRandomPosition()
                });

                switch (type)
                {
                case ViewType.Knight:
                    PostUpdateCommands.AddComponent(entity, new Knight());
                    PostUpdateCommands.AddComponent(entity, new Faction {
                        Value = FactionType.Alliance
                    });
                    movementSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeedModifier.Value   = m_Random.NextFloat(1.25f, 2);
                    walkSpeedModifier.Value       = m_Random.NextFloat(0.9f, 1.25f);
                    chargeSpeedModifier.Value     = m_Random.NextFloat(2, 3);
                    engageSqrRadius.Value         = m_Random.NextFloat(400, 2500);
                    attackAnimationDuration.Value = 1;
                    attackDamage.Value            = m_Random.NextInt(10, 30);
                    attackSpeed.Value             = m_Random.NextFloat(1, 3);
                    maxHealth.Value          = m_Random.NextInt(100, 200);
                    health.Value             = maxHealth.Value;
                    healthRegeneration.Value = m_Random.NextFloat(1, 3);
                    viewInfo.Type            = ViewType.Knight;
                    break;

                case ViewType.OrcWolfRider:
                    PostUpdateCommands.AddComponent(entity, new OrcWolfRider());
                    PostUpdateCommands.AddComponent(entity, new Faction {
                        Value = FactionType.Horde
                    });
                    movementSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeedModifier.Value   = m_Random.NextFloat(1.25f, 2);
                    walkSpeedModifier.Value       = m_Random.NextFloat(0.9f, 1.25f);
                    chargeSpeedModifier.Value     = m_Random.NextFloat(2, 3);
                    engageSqrRadius.Value         = m_Random.NextFloat(400, 2500);
                    attackAnimationDuration.Value = 1.333f;
                    attackDamage.Value            = m_Random.NextInt(10, 30);
                    attackSpeed.Value             = m_Random.NextFloat(1, 3);
                    maxHealth.Value          = m_Random.NextInt(100, 200);
                    health.Value             = maxHealth.Value;
                    healthRegeneration.Value = m_Random.NextFloat(1, 3);
                    viewInfo.Type            = ViewType.OrcWolfRider;
                    break;

                case ViewType.Skeleton:
                    PostUpdateCommands.AddComponent(entity, new Skeleton());
                    PostUpdateCommands.AddComponent(entity, new Faction {
                        Value = FactionType.Legion
                    });
                    movementSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeed.Value           = m_Random.NextFloat(1, 3);
                    rotationSpeedModifier.Value   = m_Random.NextFloat(1.25f, 2);
                    walkSpeedModifier.Value       = m_Random.NextFloat(0.9f, 1.25f);
                    chargeSpeedModifier.Value     = m_Random.NextFloat(2, 3);
                    engageSqrRadius.Value         = m_Random.NextFloat(400, 2500);
                    attackAnimationDuration.Value = 2.4f;
                    attackDamage.Value            = m_Random.NextInt(10, 30);
                    attackSpeed.Value             = m_Random.NextFloat(1, 3);
                    maxHealth.Value          = m_Random.NextInt(100, 200);
                    health.Value             = maxHealth.Value;
                    healthRegeneration.Value = m_Random.NextFloat(1, 3);
                    viewInfo.Type            = ViewType.Skeleton;
                    break;
                }

                PostUpdateCommands.SetComponent(entity, movementSpeed);
                PostUpdateCommands.SetComponent(entity, rotationSpeed);
                PostUpdateCommands.SetComponent(entity, rotationSpeedModifier);
                PostUpdateCommands.SetComponent(entity, walkSpeedModifier);
                PostUpdateCommands.SetComponent(entity, chargeSpeedModifier);
                PostUpdateCommands.SetComponent(entity, engageSqrRadius);
                PostUpdateCommands.SetComponent(entity, attackDistance);
                PostUpdateCommands.SetComponent(entity, attackAnimationDuration);
                PostUpdateCommands.SetComponent(entity, attackDamage);
                PostUpdateCommands.SetComponent(entity, attackSpeed);
                PostUpdateCommands.SetComponent(entity, maxHealth);
                PostUpdateCommands.SetComponent(entity, health);
                PostUpdateCommands.SetComponent(entity, healthRegeneration);
                PostUpdateCommands.SetComponent(entity, viewInfo);
#if UNITY_EDITOR
                EntityManager.SetName(entity, $"{viewInfo.Type} AI {entity}");
#endif
            }

            entityArray.Dispose();
        }
    public Description GetDescription()
    {
        Description res = new Description();

        if (!Empty)
        {
            string          desc;
            DescriptionItem d;

            List <DescriptionItem> constraints = new List <DescriptionItem>();

            if (!canReformToFhalanx)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attention,
                    Description    = LocalizedStrings.weaponConstraint_cantReformPhalanx,
                    ItPositiveDesc = canReformToFhalanx
                };
                constraints.Add(d);
            }
            else
            {
                if (!canReformToPhalanxInFight)
                {
                    d = new DescriptionItem()
                    {
                        Name           = LocalizedStrings.attention,
                        Description    = LocalizedStrings.weaponConstraint_cantReformPhalanxInFight,
                        ItPositiveDesc = canReformToPhalanxInFight
                    };
                    constraints.Add(d);
                }
            }

            if (!canUseWithShield)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attention,
                    Description    = LocalizedStrings.weaponConstraint_cantUseShield,
                    ItPositiveDesc = canUseWithShield
                };
                constraints.Add(d);
            }



            List <DescriptionItem> stats = new List <DescriptionItem>();

            d = new DescriptionItem()
            {
                Name           = LocalizedStrings.mass,
                Description    = Mass.ToString(StringFormats.floatNumber),
                ItPositiveDesc = true
            };
            stats.Add(d);

            if (AttackDistance > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attackDistance,
                    Description    = AttackDistance.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (AddAttack != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.attack,
                    Description    = AddAttack.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddAttack > 0
                };
                stats.Add(d);
            }

            if (AddDefence != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.defence,
                    Description    = AddDefence.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddDefence > 0
                };
                stats.Add(d);
            }

            if (AddDefenceHalfSector != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.defenceHalfSector,
                    Description    = AddDefenceHalfSector.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddDefenceHalfSector > 0
                };
                stats.Add(d);
            }

            if (AddSpeed != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.speed,
                    Description    = AddSpeed.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddSpeed > 0
                };
                stats.Add(d);
            }

            if (AddAcceleretion != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.acceleration,
                    Description    = AddAcceleretion.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddAcceleretion > 0
                };
                stats.Add(d);
            }

            if (AddRotationSpeed != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.rotationSpeed,
                    Description    = AddRotationSpeed.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddRotationSpeed > 0
                };
                stats.Add(d);
            }

            if (ChargeImpact != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeImpact,
                    Description    = ChargeImpact.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = ChargeImpact > 0
                };
                stats.Add(d);
            }

            if (ChargeDeflect != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeDeflect,
                    Description    = ChargeDeflect.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = ChargeDeflect > 0
                };
                stats.Add(d);
            }

            if (Armour > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.armour,
                    Description    = Armour.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (Damag.BaseDamage > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.baseDamage,
                    Description    = Damag.BaseDamage.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (Damag.ArmourDamage > 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.armourDamage,
                    Description    = Damag.ArmourDamage.ToString(StringFormats.floatNumber),
                    ItPositiveDesc = true
                };
                stats.Add(d);
            }

            if (MissileBlock != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.missileBlock,
                    Description    = MissileBlock.ToString(StringFormats.floatNumberPercent),
                    ItPositiveDesc = MissileBlock > 0
                };
                stats.Add(d);
            }

            if (AddChargeDamage != 0)
            {
                d = new DescriptionItem()
                {
                    Name           = LocalizedStrings.chargeDamage,
                    Description    = AddChargeDamage.ToString(StringFormats.floatSignNumberPercent) + LocalizedStrings.baseValue,
                    ItPositiveDesc = AddChargeDamage > 0
                };
                stats.Add(d);
            }

            EquipmentStats st = this;
            res.Condition = new Description.ConditionsInfo()
            {
                Name  = Tools.Extensions.GetNameLocalise(ItemDurability),
                Value = (Description.ConditionsInfo.Conditions)Enum.GetNames(typeof(Durability)).ToList().FindIndex((s) => { return(Enum.GetName(typeof(Durability), st.ItemDurability) == s); })
            };
            res.Cost = new Description.CostInfo()
            {
                CostPerOne = Cost
            };
            res.Constraints = constraints.ToArray();
            res.Stats       = stats.ToArray();
        }

        return(res);
    }