示例#1
0
        //SpellPhaseContext CreatePhaseContext(SpellPhase phase, SpellPhaseContext sourcePhaseContext) {
        SpellPhaseContext CreatePhaseContext(SpellPhase phase, GameObject contextOwner, Vector3 position, Quaternion rotation)
        {
            var        prefab = phase.Template.PhaseObjectPrefab;
            GameObject carrierObject;
            //bool isTemporaryPhaseObject = prefab != null;
            bool isTemporaryPhaseObject = true;

            prefab = prefab ?? SpellManager.Instance.DefaultPhasePrefab;

            if (prefab != null)
            {
                carrierObject = GameObjectManager.Instance.Obtain(prefab, position, rotation);
            }
            else
            {
                carrierObject = GameObjectManager.Instance.ObtainEmpty(phase.ToString(), position, rotation);
            }

            var context = SpellPhaseContext.CreatePhaseContext(
                carrierObject,
                phase,
                contextOwner ?? carrierObject,
                isTemporaryPhaseObject);

            phase.NotifyStart(context);

            return(context);
        }
示例#2
0
 public virtual void OnAuraStart(SpellPhaseContext context)
 {
     for (int i = 0; i < context.Targets.Count; ++i)
     {
         var target = context.Targets [i];
         OnAuraStart(context, target);
     }
 }
示例#3
0
 public virtual void Pulse(SpellPhaseContext context)
 {
     for (int i = 0; i < context.Targets.Count; ++i)
     {
         var target = context.Targets [i];
         Pulse(context, target);
     }
 }
示例#4
0
        public override void Apply(SpellPhaseContext context, GameObject target)
        {
            var unit = target.GetComponent <Unit> ();

            if (unit != null)
            {
                var damageInfo = ObjectManager.Instance.Obtain <DamageInfo>();
                damageInfo.Value             = Random.Range(DamageMin, DamageMax);
                damageInfo.SourceFactionType = FactionManager.GetFactionType(context.ContextOwner);
                unit.Damage(damageInfo);
            }
        }
示例#5
0
 void UpdateContextStatus(MultiContextPhase phase, int index, SpellPhaseContext context, ref int activeContextCount)
 {
     if (context == null || context.ContextOwner == null)
     {
         // context was active but carrier object or ContextOwner have been removed
         phase.CleanUp(index);
     }
     else if (context.TimeLeft <= 0)
     {
         // context expired
         phase.NotifyEnd(index);
     }
     else
     {
         // context is still active
         ++activeContextCount;
     }
 }
示例#6
0
        protected internal override void NotifyStart(SpellPhaseContext context)
        {
            ++ActiveContextCount;
            ++ContextCount;

            if (Contexts == null)
            {
                Contexts = new SpellPhaseContext[8];
                contextActiveStatuses = new bool[8];
            }
            else
            {
                if (ContextCount > contexts.Length)
                {
                    System.Array.Resize(ref contexts, ContextCount);
                    System.Array.Resize(ref contextActiveStatuses, ContextCount);
                }
            }
            context.Index           = ContextCount - 1;
            Contexts[context.Index] = context;
            contextActiveStatuses [context.Index] = true;

            context.NotifyStart();
        }
示例#7
0
 public virtual void OnAuraEnd(SpellPhaseContext context, GameObject target)
 {
 }
示例#8
0
 public virtual void Pulse(SpellPhaseContext context, GameObject target)
 {
 }
示例#9
0
 public virtual void Apply(SpellPhaseContext context, GameObject target)
 {
 }
示例#10
0
 protected internal override void NotifyStart(SpellPhaseContext context)
 {
     Context  = context;
     isActive = true;
     context.NotifyStart();
 }
示例#11
0
 protected internal abstract void NotifyStart(SpellPhaseContext context);
示例#12
0
 void InitializeProjectile(SpellPhaseContext context, GameObject target, Vector3 targetPosition)
 {
     // TODO: Set projectile target and impact callback
 }