예제 #1
0
        public fieldUnit(field obj, GameController game, string modelname, string texturename, Vector4 color, float hp, float damage, float speed, float acceleration, float attackDelay)
            : base(game)
        {
            this.game = game;
            this.master = obj;
            this.pos = obj.pos;
            this.texturename = texturename;
            this.modelname = modelname;
            type = GameObjectType.FieldPlayer;
            getSizeRatioAndTransformation();

            // Stats
            this.hp = hp;
            mass = hp / size_ratio;
            massDefault = mass;
            this.damage = damage;
            this.movementSpeed = speed;
            this.movementSpeedDefault = movementSpeed;
            this.acceleration = acceleration;
            this.maxAttackDelay = attackDelay;
            this.maxHitDelay = Constants.enemyHitDelay;
            this.maxRotationSpeed = Constants.playerRotationSpeed;
            this.attackingAngle = Constants.attackingAngle;

            // Gamelogic
            isCollidable = false;

            // Model
            colorDefault = color;
            this.color = colorDefault;
            refreshModel(this.color);

            // Randomise position
            this.accX = acceleration * ((float)Math.Cos(game.player.rotationAngle));
            this.accY = acceleration * ((float)Math.Sin(game.player.rotationAngle));

            // MISC
            isAffectedByVortex = true;
            colossal = true;

            game.Add(this);
        }
예제 #2
0
 private void updateField()
 {
     if (fieldActive)
     {
         if (fieldLevelChanged)
         {
             if (field != null)
             {
                 field.kill();
             }
             field = new field(game);
             fieldLevelChanged = false;
         }
     }
     else
     {
         if (field != null)
         {
             field.kill();
             field = null;
         }
     }
 }