Пример #1
0
 public EnemyVision(float sightForPlayerDistance, float enemySightDelay)
 {
     this.SightForPlayerDistance = sightForPlayerDistance;
     this.enemySightDelay = enemySightDelay;
     enemySawPlayerTimer = new Timer();
     Reset();
 }
Пример #2
0
        // Constructor
        public Bullet(World world, Vector2 position, float width, float height, float distance, float rotation, float density, bool bulletGoneOnCollision)
            : base(world)
        {
            this.initialPosition = position;
            this.Width = ConvertUnits.ToSimUnits(width);
            this.Height = ConvertUnits.ToSimUnits(height);
            this.distance = distance;
            this.Done = false;
            doneTimer = new Timer();

            // Make the bullet in the physics world
            this.physicsObj = new PhysicsObject(this, this.world, position, width, height, density);
            this.physicsObj.body.IgnoreGravity = true;
            this.physicsObj.body.Rotation = rotation;
            this.physicsObj.body.FixedRotation = true;

            // We want the bullet to disappear once it hits something
            if (bulletGoneOnCollision)
            {
                this.physicsObj.body.OnCollision += new OnCollisionEventHandler(onCollision);
            }
            else
            {
                this.physicsObj.body.OnCollision += new OnCollisionEventHandler(onSilentCollision);
            }
        }
 public LivingEntityRepresentation(LivingEntity livingEntity)
 {
     this.livingEntity = livingEntity;
     blink = false;
     blinkTimer = new Timer();
     blinkColor = new Color(255, 255, 255, 0);
     randomShake = new Random();
     shakePositionOffset = Vector2.Zero;
     shakeTimer = new Timer();
 }
Пример #4
0
        // Constructor
        public FallingPlatformTile(World world, Vector2 position, float width, float fallDelay, float resetDelay)
            : base(world, width)
        {
            this.Fallen = false;
            this.CollidedWithLivingEntity = false;
            spawnPosition = position;
            fallTimer = new Timer();
            this.fallDelay = fallDelay;
            resetTimer = new Timer();
            this.resetDelay = resetDelay;

            SetUpPlatformTile(spawnPosition);
        }
Пример #5
0
 public TrailParticleEmitter()
 {
     emissionTimer = new Timer();
 }
Пример #6
0
 public DebugComponent(Game1 game, ContentManager content, GraphicsDeviceManager graphics)
     : base(game)
 {
     this.game = game;
     this.content = content;
     this.graphics = graphics;
     debugTextTimer = new Timer();
 }
Пример #7
0
 public EnemyMovement(float turnAroundTimerDelay)
 {
     this.turnAroundTimerDelay = turnAroundTimerDelay;
     turnAroundTimer = new Timer();
     Reset();
 }
Пример #8
0
        public PlayerPhysicsCharacter(Entity owner, World world, Vector2 position, float width, float height, float density, OnCollision onCollision, OnSeparation onSeparation)
            : base(owner, world, position, width, height, density, onCollision, onSeparation)
        {
            // Load resources
            ConfigFile configFile = PhysicsSystem.GetPhysicsConfigFile();
            runSpeed = configFile.SettingGroups[physicsSettings].Settings["runSpeed"].GetValueAsFloat();
            runAirControlSpeed = configFile.SettingGroups[physicsSettings].Settings["airControlSpeed"].GetValueAsFloat();
            jumpImpulse = configFile.SettingGroups[physicsSettings].Settings["jumpImpulse"].GetValueAsFloat();
            wallJumpImpulse = configFile.SettingGroups[physicsSettings].Settings["wallJumpImpulse"].GetValueAsFloat();
            airControlAbility = configFile.SettingGroups[physicsSettings].Settings["airControlAbility"].GetValueAsFloat();
            terminalVelocity = configFile.SettingGroups[physicsSettings].Settings["terminalVelocity"].GetValueAsFloat();
            slideTerminalVelocity = configFile.SettingGroups[physicsSettings].Settings["slideTerminalVelocity"].GetValueAsFloat();
            dashMultiplier = configFile.SettingGroups[physicsSettings].Settings["dashMultiplier"].GetValueAsFloat();

            wallSlideEnabled = false;
            onGroundTimer = new Timer();
            onLeftWallTimer = new Timer();
            onRightWallTimer = new Timer();
            enableOnGroundDelay = true;
            enableOnLeftWallDelay = true;
            enableOnRightWallDelay = true;

            moveSpeed = runSpeed;
            airControlSpeed = runAirControlSpeed;
        }
Пример #9
0
 public Particle()
 {
     this.Active = false;
     lifeTimer = new Timer();
 }