Exemplo n.º 1
0
        /// <summary>
        /// Leave out peer if this is a AI controlled enity.
        /// </summary>
        public Entity(string name, Vector position, string team, Attribute[] attributes, MMOPeer peer)
        {
            // TODO: Create AIEntity deriving from this class.

            Name     = name;
            Position = position;
            Team     = team;

            if (peer != null)
            {
                Peer           = peer;
                m_AiControlled = false;
            }
            else
            {
                m_AiControlled = true;
            }

            if (attributes != null)
            {
                foreach (Attribute attribute in attributes)
                {
                    m_Attributes.Add(attribute.AttributeCode, attribute);
                    attribute.SetEntity(this);
                }
            }

            log.InfoFormat("Created {0} at {1} in team {2}", name, position, team);
        }
Exemplo n.º 2
0
        internal Entity CreateClientEntity(MMOPeer peer, EnterWorldRequest operation)
        {
            var position   = GetRandomWorldPosition();
            var maxHealth  = GetMaxHealth((WeaponCode)operation.Weapon);
            var attributes = new Attribute[] {
                new IntAttribute(maxHealth, AttributeCode.MaxHealth),
                new HealthAttribute(maxHealth),
                new ActionStateAttribute(),
                new FloatAttribute(7f, AttributeCode.Speed)
            };

            var skills = operation.Skills;

            Array.Resize(ref skills, skills.Length + 1);
            skills[skills.Length - 1] = operation.Weapon;
            var entity = new ClientEntity(operation.Name, position, operation.Team, attributes, peer, skills);

            World.Instance.AddEntity(entity);
            return(entity);
        }
Exemplo n.º 3
0
 internal InitialOperationHandler(MMOPeer peer)
 {
     m_Peer = peer;
 }
Exemplo n.º 4
0
 public ClientEntity(string name, Vector position, string team, Attribute[] attributes, MMOPeer peer, int[] skillData) : base(name, position, team, attributes, peer)
 {
     EquippedSkills = new SkillCollection(skillData);
 }
Exemplo n.º 5
0
 internal EntityOperationHandler(MMOPeer peer)
 {
     m_Peer = peer;
 }