Example #1
0
        public Player(Vector2 position, float scale, float angle, float speed, int maxLife)
        {
            Position            = position;
            this.lifeController = new LifeController(maxLife);
            this.scale          = scale;
            this.angle          = angle;
            this.speed          = speed;

            CreateAnimations();
            currentAnimation = idleAnimation;
        }
Example #2
0
        //

        public BossEnemy(Vector2 _position, float _rotation, Vector2 _scale, Vector2 _size, Vector2 _enemySpeed, string _texture, int _maxHealth, float _angle, float _lifetime, int _damage, float _colliderRadius) : base(_position, _scale, _size, _rotation, _texture, _damage, _colliderRadius, _enemySpeed)/*(position, rotation, scale, size, enemySpeed, texture, life)*/
        {
            Speed       = _enemySpeed;
            timetoShoot = 0.8f;

            LifeController = new LifeController(this, true, false);

            InitRouletteWheel();

            //pursuitBehaviour = new Pursuit(Transform.Position, player.Transform.Position, Speed, 1);
        }
Example #3
0
        //

        public Player(Vector2 _position, Vector2 _scale, float _rotation, Vector2 _size, Vector2 _speed, int _maxLife, string _texture, int _damage, float _radius) : base(_position, _scale, _size, _rotation, _texture, _damage, _radius, _speed)
        {
            canRespawn       = true;
            canReceiveDamage = true;
            inmunity         = false;
            canShoot         = true;

            Speed       = _speed;
            bulletsPool = new ObjectsPool <PlayerBullet>();

            LifeController = new LifeController(this, false, true, _maxLife);//TODO Sacar _maxLife del constructor, correspondería ponerlo en el lifeController.
        }
Example #4
0
        //MCU
        //float angle;
        //float angularSpeed;

        public Asteroid(Vector2 _position, Vector2 _scale, Vector2 _size, float _rotation, string _texture, int _damage, float _colliderRadius, float _lifeTime, Vector2 _speed) : base(_position, _scale, _size, _rotation, _texture, _damage, _colliderRadius, _lifeTime, _speed)
        {
            Speed = _speed;



            //powerUps = new List<PowerUp>();

            LifeController = new LifeController(this, false, false, _lifeTime);

            InitRouletteWheel();
        }
Example #5
0
        public Enemy(Vector2 initialPosition, float scale, float angle, float speed, int maxLife)
        {
            position = initialPosition;

            isAlive             = true;
            currentLife         = maxLife;
            this.lifeController = new LifeController(maxLife);
            this.scale          = scale;
            this.angle          = angle;
            this.speed          = speed;

            PlayEnemyAnimations();
            currentAnimation = idleAnimation;
        }
Example #6
0
        public virtual void Init(Vector2 position, Vector2 scale, Vector2 size, float rotation, string texture, float radius, Vector2 speed, int damage, float lifeTime)
        {
            Initialize(position, scale, size, rotation, texture, damage, radius, speed);

            BulletLifetime = lifeTime;
            timer          = 0;
            //LifeController.Destroyed = false;

            LifeController = new LifeController(this, false, false, lifeTime);

            circleCollider = new CircleCollider(transform, radius);

            Program.Characters.Add(this);
        }
Example #7
0
 protected override void CheckForCollisionsWithPlayer()
 {
     for (int i = 0; i < Program.Characters.Count; i++)
     {
         if (Program.Characters[i].LifeController.IsPlayer)
         {
             if (CircleCollider.CheckforCollisions(Program.Characters[i]))
             {
                 GiveDamage(Program.Characters[i]);
                 Console.WriteLine($"Player current damage: {Program.Characters[i].Damage}");
                 LifeController.Deactivate(this);
             }
         }
     }
 }
Example #8
0
        void CheckForCollisionsWPlayer()
        {
            for (int i = 0; i < Program.Characters.Count; i++)
            {
                if (Program.Characters[i].LifeController.IsPlayer && CircleCollider.CheckforCollisions(Program.Characters[i]))
                {
                    if (CircleCollider.CheckforCollisions(Program.Characters[i]))
                    {
                        //Program.Characters[i].LifeController.GetDamage(Damage);

                        LifeController.Deactivate(this);
                    }
                }
                //Console.WriteLine("Collision W/ Player");
            }
        }
 void CheckForCollisions()
 {
     for (int i = 0; i < Program.Characters.Count; i++)
     {
         if (Program.Characters[i].LifeController.IsPlayer)
         {
             if (CircleCollider.CheckforCollisions(Program.Characters[i]))
             {
                 circleCollider.IsCollision = true;
                 Program.Characters[i].LifeController.GetDamage(Damage);
                 Console.WriteLine("Collision with Player. CurrentLife" + Program.Characters[i].LifeController.CurrentLife);
                 LifeController.Deactivate(Program.Characters[i]);
             }
         }
     }
 }
        public override void Update()
        {
            Move();
            timer += Time.DeltaTime;

            if (timer >= BulletLifetime)
            {
                LifeController.Deactivate(this);
            }

            collTimer += Time.DeltaTime;

            //if(collTimer >= maxCollTimer)
            CheckForCollisionsWEnemy();
            //CheckForCollisionsWithAsteroids();

            //Console.WriteLine($"Is collider {isCollider}");
        }
Example #11
0
        public override void Update()
        {
            if (!LifeController.Destroyed)
            {
                Move();

                LifeController.LifeTimer();

                //CreateEnemies();

                timeToCreate += Time.DeltaTime;

                if (timeToCreate >= maxTimeToCreate)
                {
                    RouletteAction();
                    timeToCreate = 0;
                }
            }
        }
Example #12
0
        void CheckForCollisions()
        {
            for (int i = 0; i < Program.Characters.Count; i++)
            {
                if (Program.Characters[i].LifeController.IsPlayer)
                {
                    if (CircleCollider.CheckforCollisions(Program.Characters[i]))
                    {
                        Console.WriteLine("Collision with player");
                        Program.Characters[i].LifeController.GetDamage(Damage);
                        //CircleCollider.IsCollision = true;
                        //Program.Characters[i].LifeController.Damaged = true;
                        LifeController.Deactivate(this);

                        Console.WriteLine($"Player current life {Program.Characters[i].LifeController.CurrentLife}");
                        //LifeController.Destroyed = true;
                        //LifeController.Deactivate();
                    }
                }
            }
        }
Example #13
0
        void CheckForCollisionsWPlayer()
        {
            for (int i = 0; i < Program.Characters.Count; i++)
            {
                if (Program.Characters[i].LifeController.IsPlayer && CircleCollider.CheckforCollisions(Program.Characters[i]))
                {
                    if (CircleCollider.CheckforCollisions(Program.Characters[i]))
                    {
                        RouletteAction();

                        //Program.Characters[i].LifeController.GetDamage(Damage);

                        LifeController.Destroyed = true;

                        //powerUps.Add(PowerUpsFactory.CreatePowerUp(PowerUpsFactory.PowerUps.damage, new Vector2(400, 400)));


                        LifeController.Deactivate(this);
                    }
                }
                //Console.WriteLine("Collision W/ Player");
            }
        }
Example #14
0
        public override void Update()
        {
            //Transform.Position += new Vector2(0, Speed.Y * Time.DeltaTime);

            //if (Transform.Position.Y >= 0)
            //    Transform.Position += new Vector2(0, Speed.Y * Time.DeltaTime);

            //if (Transform.Position.Y < 600)
            //    Transform.Position += new Vector2(0, -Speed.Y * Time.DeltaTime);

            if (!LifeController.Destroyed)
            {
                Move();

                LifeController.LifeTimer();

                //lifeTimer += Time.DeltaTime;
                //Console.WriteLine(LifeController.LifeTime);
                //if (lifeTimer >= LifeController.LifeTime)
                //    Level1Screen.RenderizableObjects.Remove(this);

                //for (int i = 0; i < Program.Bullets.Count; i++)
                //{

                //    if (circleCollider.CheckforCollisions(Program.Bullets[i]))
                //    {

                //        Level1Screen.Enemies.Remove(this);
                //        Console.WriteLine("Enemy destroyed");

                //    }
                //}

                CreateEnemies();
            }
        }
Example #15
0
        //MCU
        //float angle;
        //float angularSpeed;

        public Asteroid(Vector2 _position, Vector2 _scale, Vector2 _size, float _rotation, string _texture, int _damage, float _colliderRadius, float _lifeTime, Vector2 _speed) : base(_position, _scale, _size, _rotation, _texture, _damage, _colliderRadius, _lifeTime, _speed)
        {
            speed = _speed;

            LifeController = new LifeController(this, false, false, _lifeTime);
        }