示例#1
0
        public PlayerEntity(Vector2 startPosition, PlayerData topPlayer, PlayerData downPlayer)
        {
            this.Position.X = startPosition.X;
            this.Position.Y = startPosition.Y;

            this.topPlayer = topPlayer.Clone();
            this.downPlayer = downPlayer.Clone();

            this.topPlayer.Weapon.Processor = 0;
            this.downPlayer.Weapon.Processor = 0;

            AdjustDownPlayer();

            HitBox = new Rectangle((int)(-topPlayer.BodyImage.OriginX),(int)(-topPlayer.BodyImage.OriginY),
                (int)(Math.Max(topPlayer.BodyImage.Width, downPlayer.BodyImage.Width)),
                (int)(topPlayer.BodyImage.Height + downPlayer.BodyImage.Height));

            this.ShootingMethod = ShootingType.Parallel;

            this.CurrentImages.Add(this.topPlayer.BodyImage);
            this.CurrentImages.Add(this.downPlayer.BodyImage);

            this.health = topPlayer.Health + downPlayer.Health;
            this.acceleration = 0.6f;
            this.hspeed = 0;
            this.vspeed = 0;
            this.maxSpeed = topPlayer.Speed / 2 + downPlayer.Speed / 2;

            IntializeParticleGenerators();

            IntializeMainKeys();

            InvertEnded();
            this.invertAlarm = new Alarm(1f, TweenType.OneShot, new AlarmFinished(InvertEnded));
            AddTween(invertAlarm);

            ShieldEnded();
            this.shieldImageEntity = new ShieldImageEntity();
            this.shieldAlarm = new Alarm(0f, TweenType.OneShot, new AlarmFinished(ShieldEnded));
            AddTween(shieldAlarm);

            this.rageFullEffectAlarm = new Alarm(1.5f, TweenType.Looping, GenerateRageFullEffect);
            AddTween(this.rageFullEffectAlarm, true);

            this.Rage = MIN_RAGE;
            this.rageReady = false;
            this.runningOverclocking = null;

            this.isHit = false;
            this.hitCoolDown = new Alarm(0.3f, TweenType.OneShot, new AlarmFinished(HitEnded));
            AddTween(hitCoolDown);

            AddCollisionMask(new HitboxMask(HitBox.Width - 10, HitBox.Height - 10, (HitBox.Width - 10) / 2, (HitBox.Height - 10) / 2));

            this.speedResistance = 0.005f;
            this.minSpeedFactor = 0.5f;
            this.maxSpeedFactor = 1f;
            this.speedFactor = 1;

            this.EntityCollisionType = CollisionType.Player;
        }
示例#2
0
        protected PlayerData Clone(PlayerData p)
        {
            p.Accuracy = this.Accuracy;
            p.Health = this.Health;
            p.Speed = this.Speed;
            p.Weapon = this.Weapon;

            p.LeftThrusterPosition = new List<Vector2>();
            foreach (Vector2 vector in this.LeftThrusterPosition)
            {
                p.LeftThrusterPosition.Add(new Vector2(vector.X, vector.Y));
            }

            p.RightThrusterPosition = new List<Vector2>();
            foreach (Vector2 vector in this.RightThrusterPosition)
            {
                p.RightThrusterPosition.Add(new Vector2(vector.X, vector.Y));
            }

            p.UpThrusterPosition = new List<Vector2>();
            foreach (Vector2 vector in this.UpThrusterPosition)
            {
                p.UpThrusterPosition.Add(new Vector2(vector.X, vector.Y));
            }

            p.LoadContent();
            p.Weapon.LoadContent();

            return p;
        }