コード例 #1
0
ファイル: Enemy.cs プロジェクト: LuddeW/StarWarzDefence
 public Enemy(Texture2D texture, Game1 game, SimplePath path)
     : base(texture, Vector2.Zero,new Vector2(texture.Width / 2, texture.Height / 2))
 {
     this.pos = path.GetPos(path.endT);
     this.texture = texture;
     this.game = game;
     this.path = path;
     currentpos = path.beginT;
     followPath = path.GetPos(currentpos + 0.1f) - path.GetPos(currentpos);
 }
コード例 #2
0
        public void Update(double deltaTime, SimplePath path)
        {
            oldPosition = position;

            if (slowedTimer <= 0)
            {
                texPos += (float)(speed * deltaTime);
                color = originalColor;
            }
            else
            {
                texPos += (float)(speed * deltaTime) * slowedModifier;
                color = Color.CornflowerBlue;
            }

            slowedTimer -= deltaTime;

            position = path.GetPos(texPos);

            if (health <= 0)
            {
                UserInterface.gold += goldValue;
                isDead = true;
            }

            LookAt(position, oldPosition);

            base.Update(deltaTime);
        }
コード例 #3
0
ファイル: Creep.cs プロジェクト: KodaCreations/TowerDefense
        public void Update(double deltaTime, SimplePath path)
        {
            oldPosition = position;

            if (slowedTimer <= 0)
            {
                texPos += (float)(speed * deltaTime);
                color   = originalColor;
            }
            else
            {
                texPos += (float)(speed * deltaTime) * slowedModifier;
                color   = Color.CornflowerBlue;
            }


            slowedTimer -= deltaTime;

            position = path.GetPos(texPos);

            if (health <= 0)
            {
                UserInterface.gold += goldValue;
                isDead              = true;
            }

            LookAt(position, oldPosition);

            base.Update(deltaTime);
        }