Ejemplo n.º 1
0
        public static Avatar CreateAvatar(Server_ server, String id, Common.Classes.Unit unitClass, Common.Classes.HeroClass heroClass, Vector3 position, float rotation, float scale, int team, Player player)
        {
            Avatar avatar = new Avatar(server, id, unitClass, heroClass, position, rotation, scale);

            avatar.Player = player;
            avatar.Team = team;
            avatar.MotionObject = server.motionSimulation.CreateUnit(position, rotation, scale, unitClass.CollisionRadius);
            avatar.MotionObject.MaxSpeed = avatar.Stats.GetStat(Common.UnitStats.MovementSpeed);
            server.MotionToObject.Add(avatar.MotionObject, avatar);
            server.VicinityManager.Register(avatar, position, unitClass.SightRange, unitClass.VisibilityRange);
            server.Objects.Add(avatar.Id, avatar);

            avatar.InitializeAbility();

            return avatar;
        }
Ejemplo n.º 2
0
        protected Unit(Server_ server, String id, Common.Classes.Unit unitClass, Common.Classes.HeroClass heroClass, Vector3 position, float rotation, float scale)
            : base(server, id, unitClass, position, rotation, scale)
        {
            Stats = new Common.UnitStatsValues
            {
                UnitClass = unitClass,
                HeroClass = heroClass
            };
            Stats.Bonuses[Common.UnitStats.HitPoints] = Stats.GetStat(Common.UnitStats.MaxHitPoints);
            Stats.Bonuses[Common.UnitStats.Mana] = Stats.GetStat(Common.UnitStats.MaxMana);

            List<AbilitySlot> abs = new List<AbilitySlot>();
            foreach (var a in UnitClass.Abilities)
                abs.Add(new AbilitySlot{ Ability = a });
            if(HeroClass != null)
                foreach (var a in HeroClass.Abilities)
                    abs.Add(new AbilitySlot { Ability = a });
            abilities = abs.ToArray();

            observers = new Dictionary<string, Unit>();

            state = new Normal(this);
            IsLeveling = true;
        }
Ejemplo n.º 3
0
 public static void CreateProp(Server_ server, Common.Classes.Prop class_, Vector3 position, float rotation, float scale)
 {
     Prop prop = new Prop(class_, position, rotation, scale);
     prop.MotionObject = server.motionSimulation.CreateStatic(position, rotation, scale, class_.CollisionRadius);
     server.Props.Add(prop);
 }
Ejemplo n.º 4
0
 protected Avatar(Server_ server, String id, Common.Classes.Unit unitClass, Common.Classes.HeroClass heroClass, Vector3 position, float rotation, float scale)
     : base(server, id, unitClass, heroClass, position, rotation, scale)
 {
     encodedType = "Avatar";
 }