コード例 #1
0
ファイル: Avatar.cs プロジェクト: Keldyn/BattleOfTheClans
        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;
        }
コード例 #2
0
ファイル: Unit.cs プロジェクト: Keldyn/BattleOfTheClans
        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;
        }
コード例 #3
0
ファイル: Prop.cs プロジェクト: Keldyn/BattleOfTheClans
 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);
 }
コード例 #4
0
ファイル: Avatar.cs プロジェクト: Keldyn/BattleOfTheClans
 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";
 }