Beispiel #1
0
        public void CreateUnit(Team team, Vector2 pos, UnitTextures tex, SoundEffect sound, Color color, float depth, float speed, float attackSpeed, float bulletSpeed, float health, float radius, bool flipped)
        {
            GameObject unit = new GameObject(pos, flipped ? tex.Left : tex.Right);

            unit.Depth = depth;
            unit.Components.Add(new Unit(unit, team, sound, color, speed, attackSpeed, bulletSpeed, tex));
            unit.Components.Add(new Health(unit, health));
            unit.Components.Add(new CircleCollider(unit, radius));
            team.AddUnit(unit);
        }
Beispiel #2
0
 public Unit(GameObject GO, Team team, SoundEffect sound, Color color, float movespeed, float attackSpeed, float projectileDistance, UnitTextures textures)
     : base(GO)
 {
     Speed = movespeed;
     this.color = color;
     CooldownToAttack = attackSpeed;
     AttackSpeed = attackSpeed;
     Team = team;
     ProjectileDistance = projectileDistance;
     Sound = sound;
     UnitTexture = textures;
 }