Ejemplo n.º 1
0
        /// <summary>
        /// 敵(Straight, Curve)の初期化を行う
        /// </summary>
        /// <param name="loadModel"></param>
        /// <param name="readCParameter"></param>
        /// <param name="readIParameter"></param>
        public virtual void InitializeEnemy(EnemyModel loadModel, CommonParameter readCParameter, IndividualParameter readIParameter)
        {
            iParameter = readIParameter;
            speed      = iParameter.speed;

            InitializeCommonParameter(loadModel, readCParameter);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 全種の敵の共通パラメータを初期化する
        /// </summary>
        protected virtual void InitializeCommonParameter(EnemyModel loadModel, CommonParameter readCParameter)
        {
            enemyModel = loadModel;
            cParameter = readCParameter;
            switch (cParameter.modelType)
            {
            case 0:
            case 1:
                enemyModel.outsideRad   = 80;
                enemyModel.collisionRad = 40;
                break;

            case 2:
            case 3:
                enemyModel.outsideRad   = 212;
                enemyModel.collisionRad = 106;
                break;

            case 4:
                enemyModel.outsideRad   = 84;
                enemyModel.collisionRad = 42;
                break;

            case 5:
                enemyModel.outsideRad   = 500;
                enemyModel.collisionRad = 250;
                break;

            default:
                enemyModel.outsideRad   = 80;
                enemyModel.collisionRad = 40;
                break;
            }
            cParameter.scaleMax        = cParameter.scale;
            enemyModel.outsideRad     *= cParameter.scale;
            enemyModel.outsideRadMax   = enemyModel.outsideRad;
            enemyModel.collisionRad   *= cParameter.scale;
            enemyModel.collisionRadMax = enemyModel.collisionRad;
            cParameter.lifeMax         = cParameter.life;

            transform = new Matrix[enemyModel.ship.Bones.Count];
            enemyModel.ship.CopyAbsoluteBoneTransformsTo(transform);

            SetCollision();

            rotationAngle = 90;
            rotation      = Matrix.CreateRotationY(MathHelper.ToRadians(-cParameter.angle - rotationAngle));

            world = Matrix.CreateScale(cParameter.scale) * rotation * Matrix.CreateTranslation(Position);
        }
Ejemplo n.º 3
0
        protected override void InitializeCommonParameter(EnemyModel loadModel, CommonParameter readCParameter)
        {
            enemyModel = loadModel;
            cParameter = readCParameter;
            switch (cParameter.modelType)
            {
            case 0:
            case 1:
                enemyModel.outsideRad   = 80;
                enemyModel.collisionRad = 40;
                break;

            case 2:
            case 3:
                enemyModel.outsideRad   = 212;
                enemyModel.collisionRad = 106;
                break;
            }
            cParameter.scaleMax        = cParameter.scale;
            enemyModel.outsideRad     *= cParameter.scale;
            enemyModel.outsideRadMax   = enemyModel.outsideRad;
            enemyModel.collisionRad   *= cParameter.scale;
            enemyModel.collisionRadMax = enemyModel.collisionRad;
            cParameter.lifeMax         = cParameter.life;

            transform = new Matrix[enemyModel.ship.Bones.Count];
            enemyModel.ship.CopyAbsoluteBoneTransformsTo(transform);

            SetCollision();

            rotationAngle = 90;
            rotation      = Matrix.CreateRotationY(MathHelper.ToRadians(-cParameter.angle - rotationAngle));

            position = Position;
            SetCollision();

            firstPosition.rad      = cParameter.rad;
            firstPosition.angle    = cParameter.angle;
            firstPosition.position = new Vector3(
                (float)(firstPosition.rad * Math.Cos(MathHelper.ToRadians(cParameter.angle))),
                0,
                (float)(firstPosition.rad * Math.Sin(MathHelper.ToRadians(cParameter.angle))));

            world = Matrix.CreateScale(cParameter.scale) * rotation * Matrix.CreateTranslation(Position);
        }
Ejemplo n.º 4
0
        public override void InitializeEnemy(EnemyModel loadModel, CommonParameter readCParameter, IndividualParameter readIParameter)
        {
            iParameter = readIParameter;
            switch (iParameter.numberOfPoint)
            {
            case 0:
                passedPoint1 = true;
                passedPoint2 = true;
                break;

            case 1:
                passedPoint1 = false;
                passedPoint2 = true;
                break;

            case 2:
                passedPoint1 = false;
                passedPoint2 = false;
                break;

            default:
                passedPoint1 = true;
                passedPoint2 = true;
                break;
            }

            speed = iParameter.speed;

            InitializeCommonParameter(loadModel, readCParameter);

            iParameter.point1.position = new Vector3(
                (float)(iParameter.point1.rad * Math.Cos(MathHelper.ToRadians(iParameter.point1.angle))),
                0f,
                (float)(iParameter.point1.rad * Math.Sin(MathHelper.ToRadians(iParameter.point1.angle))));
            iParameter.point2.position = new Vector3(
                (float)(iParameter.point2.rad * Math.Cos(MathHelper.ToRadians(iParameter.point2.angle))),
                0f,
                (float)(iParameter.point2.rad * Math.Sin(MathHelper.ToRadians(iParameter.point2.angle))));

            translation  = iParameter.point1.position - firstPosition.position;
            translation2 = iParameter.point2.position - iParameter.point1.position;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 敵(Sprial)の初期化を行う
        /// </summary>
        /// <param name="loadModel"></param>
        /// <param name="readCParameter"></param>
        public void InitializeEnemy(EnemyModel loadModel, CommonParameter readCParameter)
        {
            speed = 1;

            InitializeCommonParameter(loadModel, readCParameter);
        }