Exemplo n.º 1
0
 protected override void Behave(bool trigger, float time)
 {
     if (CheckOffScreen())
     {
         Life       = 0;
         IsDead     = true;
         pointValue = 0;
         float     angle = (float)Math.Atan2(velocity.Y, velocity.X) - MathHelper.Pi;
         EBrancher b     = new EBrancher(EnemyManager.EBranchTex, position, angle, 0, 5);
         EnemyManager.AddEnemy((Enemy)b);
     }
 }
Exemplo n.º 2
0
        protected override void Behave(bool trigger, float time)
        {
            currentLife += time;
            if (!hasBranched && currentLife > BRANCH_TIME && positionInChain < repetitions)
            {
                Vector2 nextPos = new Vector2();
                float   rot;

                for (int i = 0; i < numBranches; i++)
                {
                    nextPos.X = position.X + (float)Math.Cos(angle) * length;
                    nextPos.Y = position.Y + (float)Math.Sin(angle) * length;
                    rot       = angle + (float)((Game1.rand.NextDouble() - 0.5f) * 2) * (MathHelper.PiOver4 / 2);
                    EBrancher b = new EBrancher(tex, nextPos, rot, positionInChain + 1, repetitions);
                    EnemyManager.AddEnemy((Enemy)b);
                }

                hasBranched = true;
            }
        }