コード例 #1
0
        public bool RunPower(Actor user, PowerScript power, Actor target = null,
                             Vector3D targetPosition = null, TargetMessage targetMessage = null)
        {
            // replace power with existing channel instance if one exists
            if (power is ChanneledSkill)
            {
                var existingChannel = _FindChannelingSkill(user, power.PowerSNO);
                if (existingChannel != null)
                {
                    power = existingChannel;
                }
                else  // new channeled skill, add it to the list
                {
                    _channeledSkills.Add((ChanneledSkill)power);
                }
            }

            // copy in context params
            power.User           = user;
            power.Target         = target;
            power.World          = user.World;
            power.TargetPosition = targetPosition;
            power.TargetMessage  = targetMessage;

            _StartScript(power);
            return(true);
        }
コード例 #2
0
        private void _StartScript(PowerScript script)
        {
            var powerEnum = script.Run().GetEnumerator();

            if (powerEnum.MoveNext() && powerEnum.Current != PowerScript.StopExecution)
            {
                _executingScripts.Add(new ExecutingScript
                {
                    PowerEnumerator = powerEnum,
                    Script          = script
                });
            }
        }
コード例 #3
0
 public static PowerScript CreateImplementationForPowerSNO(int powerSNO)
 {
     if (_implementations.ContainsKey(powerSNO))
     {
         PowerScript script = (PowerScript)Activator.CreateInstance(_implementations[powerSNO]);
         script.PowerSNO = powerSNO;
         return(script);
     }
     else
     {
         Logger.Debug("Unimplemented power: {0}", powerSNO);
         return(null);
     }
 }