예제 #1
0
        public Legion(Vector2 position)
            : base(position)
        {
            Tesseract.Engine.GameWorld.GameState.InstantiateCurrent(new StoryElement(LevelManager.world.Reward));
            body = new TriangleBody(0, null);
            Position = position;
            speed = 1f;
            health = 5;
            spawnTime = 0;
            this.Invulnerable = true;
            fire = ContentManager.Load<SoundEffect>("Sound/BigShot04");

            Halderon = new SphereCollider();

            this.OnHit += (o, e) =>
            {
                if (!this.Invulnerable)
                {
                    for(int i = 0; i < 8; ++i)
                    {
                        Vector2 circle = new Vector2((float)Math.Sin(i / 8f * 6.28f), (float)Math.Cos(i / 8f * 6.28f)) / 5f;
                        Tesseract.Engine.GameWorld.GameState.InstantiateCurrent(new EnemyMelee(this.Position + circle, (int)TesseractWorldManager.MeleeSubtype.Chaser));
                    }
                }

            };
            radius = .6f;
        }
예제 #2
0
        public TriangleBody(int Depth, TriangleBody Parent)
        {
            depth = Depth;
            if (Depth >= 0){
                top = new TriangleBody(-1, this);
                left = new TriangleBody(-1, this);
                right = new TriangleBody(-1, this);

            }
            parent = Parent;
        }
예제 #3
0
        public void drawTri(Vector2 pos, TriangleBody bod, SpriteBatch batch)
        {
            float scale = 1 / (float)Math.Pow(2, bod.depth);
            if(bod.depth==0)
                build.nGon(batch, Screen.RelationToPosition(pos), radius * 300 * scale, 3, (float)Math.PI / 6);

            if (bod.top.depth == -1)
            {
                //top
                //build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X, pos.Y - radius * scale)), radius * 300 * scale, 3, (float)Math.PI / 6);
                //left
                //build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X + radius / 2 * (float)Math.Sqrt(3) * scale, pos.Y + radius / 2 * scale)), radius * 300 * scale, 3, (float)Math.PI / 6);
                //right
                //build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X - radius / 2 * (float)Math.Sqrt(3) * scale, pos.Y + radius / 2 * scale)), radius * 300 * scale, 3, (float)Math.PI / 6);

            }
            else
            {
                float scale2 = 1 / (float)Math.Pow(2, bod.depth+1);
                //top
                build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X, pos.Y - radius * scale2)), radius * 300 * scale2, 3, (float)Math.PI / 6);
                drawTri(new Vector2(pos.X, pos.Y - radius * scale2), bod.top, batch);
                //left
                build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X + radius / 2 * (float)Math.Sqrt(3) * scale2, pos.Y + radius / 2 * scale2)), radius * 300 * scale2, 3, (float)Math.PI / 6);
                drawTri(new Vector2(pos.X + radius / 2 * (float)Math.Sqrt(3) * scale2, pos.Y + radius / 2 * scale2), bod.top, batch);
                //right
                build.nGon(batch, Screen.RelationToPosition(new Vector2(pos.X - radius / 2 * (float)Math.Sqrt(3) * scale2, pos.Y + radius / 2 * scale2)), radius * 300 * scale2, 3, (float)Math.PI / 6);
                drawTri(new Vector2(pos.X - radius / 2 * (float)Math.Sqrt(3) * scale2, pos.Y + radius / 2 * scale2), bod.top, batch);
            }
        }