Esempio n. 1
0
 public void RemoveCreep(SYCreep e)
 {
     if (e != null)
     {
         RemoveCreep(e.id);
     }
 }
Esempio n. 2
0
    public EffectEnemyHit(SYCreep enemy, float dir, float size, Map m)
        : base(m)
    {
        size = MathHelper.Clamp(size, 0.2f, 2f);

        mesh = new Mesh(enemy.sprite.Mesh.Vertices, enemy.sprite.Mesh.UV);

        mesh.FillColor = true;
        mesh.Texture   = enemy.sprite.Texture;

        mesh.ModelMatrix = enemy.sprite.Mesh.ModelMatrix;
        mesh.Scale(1.2f);

        /*
         * Random rng = new Random();
         * Vector2 ringPos = new Vector2((float)rng.NextDouble() - 0.5f,
         *      (float)rng.NextDouble() - 0.5f);
         * map.AddEffect(new EffectRing(enemy.position + ringPos, 2f + 2f * size, 0.7f, Color.White, map));
         *///NO RING PLZ

        Vector2 spikeDir = TKMath.GetAngleVector(dir) * 2 * size;

        map.AddEffect(new EffectSpike(enemy.Position - spikeDir, enemy.Position + spikeDir,
                                      2f * size, 0.4f, Color.White, map));
        map.AddEffect(new EffectImpactQuad(enemy.Position, size, map));
    }
Esempio n. 3
0
    public int AddCreep(SYCreep c)
    {
        int id = NextEnemyIndex;

        creepList[id] = c;

        return(id);
    }
Esempio n. 4
0
    void DoMovement()
    {
        Vector2 colPos = Position + velocity * new Vector2(Game.delta, 0);

        SYCreep coll = Map.GetActorAtPos <SYCreep>(Position + velocity * new Vector2(Game.delta, 0), Size, this);

        if (coll != null || Map.GetCollision(this, velocity * new Vector2(Game.delta, 0)))
        {
            if (target == null)
            {
                IdleTargetReached();
            }

            velocity.X *= -0.7f;

            SendPositionToPlayer(Map.playerList);
            if (coll != null)
            {
                coll.SendPositionToPlayer(Map.playerList);
            }
        }

        colPos = Position + velocity * new Vector2(0, Game.delta);

        coll = Map.GetActorAtPos <SYCreep>(Position + velocity * new Vector2(0, Game.delta), Size, this);
        if (coll != null || Map.GetCollision(this, velocity * new Vector2(0, Game.delta)))
        {
            if (target == null)
            {
                IdleTargetReached();
            }

            velocity.Y *= -0.7f;

            SendPositionToPlayer(Map.playerList);
            if (coll != null)
            {
                coll.SendPositionToPlayer(Map.playerList);
            }
        }

        position += velocity * Game.delta;
    }