public Enemy(Game game, Player player, Level level, GameObject body, GameObject fist, Vector3 pos)
            : base(game)
        {
            this.body = body;
            this.fist = fist;

            this.player = player;
            this.level = level;

            damage = 2;
            health = 10;

            fistX = 0;
            fistY = 0;
            fistZ = radius;

            //Attack parameters

            attackCooldown = 1f;  //Time till enemy can attack again

            isAttacking = false;
            canAttack = true;
            enemyYaw = 0;
            fistDefaultAngle = 0.5f;
            angle = fistDefaultAngle;
            speed = (2 * MathHelper.Pi) * 2;

            //Set body GameObject parameters
            setPosition(pos);
            body.setPosition(position);
            body.physobj.coltype = PhysicsObject.ColliderType.enemy;

            //Set fist GameObject parameters
            fist.setScale(0.5f);
            fistPosition = new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z);
            fist.setPosition(fistPosition);
            fist.physobj.coltype = PhysicsObject.ColliderType.enemy;
            prevFistPos = fistPosition;
            fist.physobj.isStatic = true;
        }
Exemple #2
0
        public Enemy(Game game, Player player, Level level, GameObject body, GameObject fist, Vector3 pos)
            : base(game)
        {
            this.body = body;
            this.fist = fist;

            this.player = player;
            this.level  = level;

            damage = 2;
            health = 10;

            fistX = 0;
            fistY = 0;
            fistZ = radius;

            //Attack parameters

            attackCooldown = 1f;  //Time till enemy can attack again

            isAttacking      = false;
            canAttack        = true;
            enemyYaw         = 0;
            fistDefaultAngle = 0.5f;
            angle            = fistDefaultAngle;
            speed            = (2 * MathHelper.Pi) * 2;

            //Set body GameObject parameters
            setPosition(pos);
            body.setPosition(position);
            body.physobj.coltype = PhysicsObject.ColliderType.enemy;

            //Set fist GameObject parameters
            fist.setScale(0.5f);
            fistPosition = new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z);
            fist.setPosition(fistPosition);
            fist.physobj.coltype  = PhysicsObject.ColliderType.enemy;
            prevFistPos           = fistPosition;
            fist.physobj.isStatic = true;
        }
Exemple #3
0
        public Player(Game game, GameObject body, GameObject fist, Vector3 pos, Camera cam)
            : base(game)
        {
            this.body = body;
            this.fist = fist;

            damage  = 2;
            health  = 10;
            forward = back = left = right = 0;

            fistX = 0;
            fistY = 0;
            fistZ = radius;

            camX             = 0;
            camY             = 0;
            camZ             = radius * 10;
            isAttacking      = false;
            canAttack        = true;
            fistDefaultAngle = 0.5f;
            angle            = fistDefaultAngle;
            speed            = (2 * MathHelper.Pi) * 2;

            //Set body GameObject parameters
            setPosition(pos);
            body.physobj.coltype = PhysicsObject.ColliderType.player;

            //Set fist GameObject parameters
            fist.setScale(0.5f);
            new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z);
            fist.setPosition(fistPosition);
            fist.physobj.coltype  = PhysicsObject.ColliderType.player;
            prevFistPos           = fistPosition;
            fist.physobj.isStatic = true;

            camera = cam;
            setCamera();
        }
        public Player(Game game, GameObject body, GameObject fist, Vector3 pos, Camera cam)
            : base(game)
        {
            this.body = body;
            this.fist = fist;

            damage = 2;
            health = 10;
            forward = back = left = right = 0;

            fistX = 0;
            fistY = 0;
            fistZ = radius;

            camX = 0;
            camY = 0;
            camZ = radius * 10;
            isAttacking = false;
            canAttack = true;
            fistDefaultAngle = 0.5f;
            angle = fistDefaultAngle;
            speed = (2 * MathHelper.Pi) * 2;

            //Set body GameObject parameters
            setPosition(pos);
            body.physobj.coltype = PhysicsObject.ColliderType.player;

            //Set fist GameObject parameters
            fist.setScale(0.5f);
            new Vector3(fistX + body.physobj.position.X, fistY + body.physobj.position.Y, fistZ + body.physobj.position.Z);
            fist.setPosition(fistPosition);
            fist.physobj.coltype = PhysicsObject.ColliderType.player;
            prevFistPos = fistPosition;
            fist.physobj.isStatic = true;

            camera = cam;
            setCamera();
        }
Exemple #5
0
 public void setPosition(Vector3 pos)
 {
     position = pos;
     body.setPosition(pos);
 }