Example #1
0
 /// <summary>
 /// Creates a new melee attack state with the given actor and interval.
 /// </summary>
 /// <param name="actor">The melee combat actor.</param>
 /// <param name="repathInterval">The time in seconds between repathing to attack.</param>
 /// <param name="evaluateInterval">The time in seconds between state change evaluation.</param>
 public MeleeAttackState(MeleeCombatActor actor,
                         float repathInterval, float evaluateInterval)
     : base(actor, evaluateInterval)
 {
     this.actor     = actor;
     RepathInterval = repathInterval;
 }
 public override CombatActor Unwrap()
 {
     if (instance == null)
     {
         // Create the actor and set the values
         // based on the inspector fields.
         instance              = MeleeCombatActor.MakeActor(transform);
         instance.HealthMeter  = healthMeter;
         instance.Navigator    = navigator;
         instance.StateTable   = table.Unwrap();
         instance.Health       = health;
         instance.MaxHealth    = maxHealth;
         instance.SpeedFactor  = speedFactor;
         instance.Range        = range;
         instance.AttackDelay  = attackDelay;
         instance.AttackDamage = attackDamage;
         // Initialize the state of this actor.
         instance.EvaluateStateChange();
     }
     return(instance);
 }
Example #3
0
 /// <summary>
 /// Creates a new melee attack building state with the given actor and interval.
 /// </summary>
 /// <param name="actor">The actor to attack buildings.</param>
 /// <param name="evaluateInterval">The interval to re-evaluate state.</param>
 public MeleeAttackBuildingState(MeleeCombatActor actor, float evaluateInterval)
     : base(actor, evaluateInterval)
 {
     this.actor = actor;
 }