Beispiel #1
0
        protected override void preInitOnScene()
        {
            ammunitionModel = sceneMgr.CreateEntity("Torpedo" + ammunitionID.ToString(), "Torpedo.mesh");
            ammunitionNode  =
                sceneMgr.RootSceneNode.CreateChildSceneNode("Torpedo" + ammunitionID.ToString(),
                                                            hiddenPosition);

            Vector3 oVector = new Vector3(0, 0, -1);

            innerNode =
                ammunitionNode.CreateChildSceneNode("TorpedoInner" + ammunitionID.ToString(), new Vector3(0, 0, 0));
            innerNode.AttachObject(ammunitionModel);

            torpedoAnimation         = new ConstRotateNodeAnimation(innerNode, 75, oVector, "ConstRot");
            torpedoAnimation.Enabled = true;
            torpedoAnimation.Looped  = true;

            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(ammunitionNode, framework.MinimapMgr, "Cube.mesh", ColourValue.White,
                                    ammunitionModel);
                minimapItem.ScaleOverride = new Vector2(4, 2);
                minimapItem.Refresh();
                minimapItem.Hide();
            }

            ammunitionNode.SetVisible(false);
            innerNode.SetVisible(false);
        }
Beispiel #2
0
        //Deprecated
        protected void initOnScene()
        {
            visualRotation  = 0;
            ammunitionModel = sceneMgr.CreateEntity("Bomb" + ammunitionID.ToString(), "Bomb.mesh");
            ammunitionNode  =
                sceneMgr.RootSceneNode.CreateChildSceneNode("Bomb" + ammunitionID.ToString(),
                                                            new Vector3(-100000, -120000, 0));

            if (ammunition.Direction == Direction.Right)
            {
                ammunitionNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.NEGATIVE_UNIT_Y);
            }
            else
            {
                ammunitionNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.UNIT_Y);
            }

            ammunitionNode.Orientation *= new Quaternion((float)ammunition.Angle, Vector3.UNIT_X);


            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(ammunitionNode, framework.MinimapMgr, "Cube.mesh", ColourValue.White,
                                    ammunitionModel);
                minimapItem.ScaleOverride = new Vector2(2, 4);
                minimapItem.Refresh();
            }

            refreshPosition();
            ammunitionNode.AttachObject(ammunitionModel);
        }
Beispiel #3
0
        public virtual void refreshPosition()
        {
            if (ammunition != null)
            {
                Vector3 axis;
                if (ammunition.Direction == Direction.Right)
                {
                    axis = Vector3.NEGATIVE_UNIT_Y;
                }
                else
                {
                    axis = Vector3.UNIT_Y;
                }


                //	float z =  getYaw();

                ammunitionNode.Orientation  = new Quaternion(Mogre.Math.HALF_PI, axis);                 // pocisk bylby bokiem w stosunku do samolotu. Ma byc w kierunku w ktorym jest samolot
                ammunitionNode.Orientation *= new Quaternion((Radian)ammunition.Angle, Vector3.UNIT_X); // pion



                Vector2 v = UnitConverter.LogicToWorldUnits(ammunition.Center);
                ammunitionNode.SetPosition((float)(v.x), (float)(v.y), 0);
                // refresh minimap
                if (minimapItem != null)
                {
                    minimapItem.Refresh();
                }
            }
        }
Beispiel #4
0
        protected override void preInitOnScene()
        {
            ammunitionModel = sceneMgr.CreateEntity("Bomb" + ammunitionID.ToString(), "Bomb.mesh");
            ammunitionNode  =
                sceneMgr.RootSceneNode.CreateChildSceneNode("Bomb" + ammunitionID.ToString(),
                                                            hiddenPosition);
            ammunitionNode.AttachObject(ammunitionModel);
            ammunitionNode.SetVisible(false);


            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(ammunitionNode, framework.MinimapMgr, "Cube.mesh", ColourValue.White,
                                    ammunitionModel);
                minimapItem.ScaleOverride = new Vector2(2, 4);
                minimapItem.Refresh();
                minimapItem.Hide();
            }
        }
Beispiel #5
0
        public virtual void refreshPosition()
        {
            //Modelowy plane jest null'em dla samolocikow reprezentujacych zycia
            if (plane != null)
            {
                Vector2 v = UnitConverter.LogicToWorldUnits(plane.Center);
                planeNode.SetPosition(v.x, v.y, 0.0f);
                // if (!plane.IsChangingDirection)
                {
                    if (plane.Direction == Direction.Right)// && !Plane.spinned)
                    {
                        InnerSteeringNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.NEGATIVE_UNIT_Y);
                    }
                    else
                    {
                        InnerSteeringNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.UNIT_Y);
                    }


                    InnerSteeringNode.Orientation *= new Quaternion((float)plane.RelativeAngle, Vector3.UNIT_X);

                    if (Plane.Spinned)
                    {
                        InnerSteeringNode.Orientation *= new Quaternion((float)Math.PI, Vector3.UNIT_Z);
                    }

                    if (!plane.IsEnemy)
                    {
                        //LogManager.Singleton.LogMessage("REFRESH outerNode: " + outerNode.Orientation.w +" "+ outerNode.Orientation.x +" "+ outerNode.Orientation.y +" "+ outerNode.Orientation.z, LogMessageLevel.LML_CRITICAL);
                        //LogManager.Singleton.LogMessage("REFRESH InnerSteeringNode: " + InnerSteeringNode.Orientation.w +" "+ InnerSteeringNode.Orientation.x +" "+ InnerSteeringNode.Orientation.y +" "+ InnerSteeringNode.Orientation.z, LogMessageLevel.LML_CRITICAL);
                        //LogManager.Singleton.LogMessage("plane.RelativeAngle " + plane.RelativeAngle, LogMessageLevel.LML_CRITICAL);
                    }
                }
                // refresh minimap
                if (minimapItem != null)
                {
                    minimapItem.Refresh();
                }
            }
        }
Beispiel #6
0
        //Deprecated
        protected void initOnScene()
        {
            ammunitionModel = sceneMgr.CreateEntity("Torpedo" + ammunitionID.ToString(), "Torpedo.mesh");
            ammunitionNode  =
                sceneMgr.RootSceneNode.CreateChildSceneNode("Torpedo" + ammunitionID.ToString(), new Vector3(0, 0, 0));

            Vector3 oVector = new Vector3(0, 0, -1);

            innerNode =
                ammunitionNode.CreateChildSceneNode("TorpedoInner" + ammunitionID.ToString(), new Vector3(0, 0, 0));
            innerNode.AttachObject(ammunitionModel);

            torpedoAnimation         = new ConstRotateNodeAnimation(innerNode, 75, oVector, "ConstRot");
            torpedoAnimation.Enabled = false; // wy³¹czam obroty
            torpedoAnimation.Looped  = true;

            if (ammunition.Direction == Direction.Right)
            {
                ammunitionNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.NEGATIVE_UNIT_Y);
            }
            else
            {
                ammunitionNode.Orientation = new Quaternion(Math.HALF_PI, Vector3.UNIT_Y);
            }

            ammunitionNode.Orientation *= new Quaternion((float)ammunition.Angle, Vector3.UNIT_X);


            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(ammunitionNode, framework.MinimapMgr, "Cube.mesh", ColourValue.White,
                                    ammunitionModel);
                minimapItem.ScaleOverride = new Vector2(4, 2);
                minimapItem.Refresh();
            }

            refreshPosition();
        }
Beispiel #7
0
        protected override void initOnScene()
        {
            lWingNode = innerNode.CreateChildSceneNode(name + "LWingNode", new Vector3(-8.8f, -0.2f, -1.5f));
            rWingNode = innerNode.CreateChildSceneNode(name + "RWingNode", new Vector3(8.8f, -0.2f, -1.5f));

            if (plane != null && !this.plane.IsEnemy)
            {
                EnableNightLights();
            }

            // main nodes init
            planeEntity             = sceneMgr.CreateEntity(name + "_Body", GetMainMeshName());
            planeEntity.CastShadows = EngineConfig.ShadowsQuality > 0;
            innerNode.AttachObject(planeEntity);
            outerNode.Scale(new Vector3(0.4f, 0.4f, 0.4f));

            initBlade();
            initWheels();

            SceneNode pilotNode   = innerNode.CreateChildSceneNode(planeNode.Name + "Pilot", new Vector3(0, 1.0f, -0.4f));
            Entity    pilotEntity = sceneMgr.CreateEntity(name + "_Pilot", "Pilot.mesh");

            pilotNode.AttachObject(pilotEntity);

            torpedoHolder = innerNode.CreateChildSceneNode(planeNode.Name + "TorpedoHolder", new Vector3(0, -1.6f, 1.6f));
            if (plane != null)
            {
                torpedoHolder.Scale(2.5f, 2.5f, 2.5f); // caly node jest skalowany x 0.4
                Entity torpedo = sceneMgr.CreateEntity(name + "_Torpedo", "Torpedo.mesh");
                torpedoHolder.AttachObject(torpedo);
            }


            ViewHelper.AttachAxes(sceneMgr, innerNode, 1.5f);

            refreshPosition();
            //  base.initOnScene();
            initAnimationManager();
            if (EngineConfig.SoundEnabled)
            {
                planePassSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_PLANE_PASS, this.planeNode, false, false);
            }

            if (this.plane != null && this.plane.WheelsState == WheelsState.In)
            {
                this.animationMgr.switchToGearUpDown(false);
                this.animationMgr.CurrentAnimation.Enabled = false;
                animationMgr.disableAll();
            }



            if (plane != null && plane.LocationState == LocationState.Air)
            {
                animationMgr.switchToIdle();
            }
            animationMgr.enableBlade();

            // vertex animation
            animationState = PlaneEntity.GetAnimationState("manual");

            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(outerNode, this.frameWork.MinimapMgr, "Cube.mesh", new ColourValue(0, 0.9f, 0),
                                    planeEntity);
                minimapItem.ScaleOverride = new Vector2(0, 5);
                minimapItem.MinimapNode.Translate(0, 0, 10.0f);
                minimapItem.Refresh();
            }
            // kamery


            ResetCameraHolders();
        }
Beispiel #8
0
        protected override void initOnScene()
        {
            if (tileViews != null && tileViews.Count != 9)
            {
                return;
            }

            storagePlanes  = new List <PlaneView>();
            arrestingWires = new List <SceneNode>();

            // CARRIER

            if (EngineConfig.LowDetails)
            {
                compositeModel = sceneMgr.CreateEntity(name, "Carrier_low.mesh");
            }
            else
            {
                compositeModel = sceneMgr.CreateEntity(name, "Carrier.mesh");
                //  compositeModel = sceneMgr.CreateEntity(name, "Carrier_low.mesh");
            }

            compositeModel.CastShadows = EngineConfig.ShadowsQuality > 0;


            carrierAerial1 = sceneMgr.CreateEntity(name + "Aerial1", "Aerial1.mesh");
            carrierAerial2 = sceneMgr.CreateEntity(name + "Aerial2", "Aerial2.mesh");
            // compositeModel.SetMaterialName("Carrier");
            mainNode.AttachObject(compositeModel);

            if (EngineConfig.LowDetails)
            {
                carrierHangar = sceneMgr.CreateEntity(name + "Hangar", "HangarFloor_low.mesh");
            }
            else
            {
                carrierHangar = sceneMgr.CreateEntity(name + "Hangar", "HangarFloor.mesh");
            }
            carrierHangar.CastShadows = false;

            carrierHangarNode = mainNode.CreateChildSceneNode(name + "HangarNode", Vector3.ZERO);

            carrierHangarNode.AttachObject(carrierHangar);



            carrierAerial1Node = mainNode.CreateChildSceneNode(name + "Aerial1Node", new Vector3(-8.6f, 9.1f, 5.7f - 47.8f));
            carrierAerial1Node.AttachObject(carrierAerial1);

            carrierAerial2Node = mainNode.CreateChildSceneNode(name + "Aerial2Node", new Vector3(-10.7f, 4.0f, 12.6f - 47.8f));
            carrierAerial2Node.AttachObject(carrierAerial2);

            Vector3 oVector = new Vector3(0, 1, 0);

            aerialAnimation1         = new ConstRotateNodeAnimation(carrierAerial1Node, 40, oVector, "ConstRot");
            aerialAnimation1.Enabled = true;
            aerialAnimation1.Looped  = true;

            aerialAnimation2         = new ConstRotateNodeAnimation(carrierAerial2Node, -15, oVector, "ConstRot");
            aerialAnimation2.Enabled = true;
            aerialAnimation2.Looped  = true;

            EffectsManager.Singleton.RectangularEffect(sceneMgr, mainNode, name + "lWaterTrailNode", EffectsManager.EffectType.WATERTRAIL, new Vector3(-4.6f, -5.6f, -41.0f - 47.5f), new Vector2(17, 12), new Quaternion(new Radian(new Degree(90)), Vector3.NEGATIVE_UNIT_Y), true);

            EffectsManager.Singleton.RectangularEffect(sceneMgr, mainNode, name + "rWaterTrailNode", EffectsManager.EffectType.WATERTRAIL, new Vector3(4.6f, -5.6f, -41.0f - 47.5f), new Vector2(17, 12), new Quaternion(new Radian(new Degree(90)), Vector3.NEGATIVE_UNIT_Y), true);

            adEntity = sceneMgr.CreateEntity(name + "AdEntity", "TwoSidedPlane.mesh");
            adNode   = mainNode.CreateChildSceneNode(name + "AdNode", new Vector3(0.0f, 9.1f, 5.7f - 47.8f));
            adNode.AttachObject(adEntity);
            adNode.SetVisible(false);

            float adjust = LevelView.TileWidth * 1.7f;

            // CARRIER

            if (!backgroundDummy)
            {
                InitArrestingWires();

                AddCrew();

                InitLights(new ColourValue(0.9f, 0.2f, 0.0f), new ColourValue(0.0f, 0.2f, 0.9f));

                CrewStatePlaneOnCarrier();

                mainNode.Translate(new Vector3(UnitConverter.LogicToWorldUnits(firstTileIndex), 5, -1.0f));
                mainNode.SetDirection(Vector3.UNIT_X);
                //  mainNode.Roll(-Math.HALF_PI / 6.0f);
                if (EngineConfig.DisplayingMinimap)
                {
                    minimapItem =
                        new MinimapItem(mainNode, framework.MinimapMgr, "CarrierMinimap.mesh",
                                        new ColourValue(0.162f, 0.362f, 0.59f), compositeModel);
                    minimapItem.ScaleOverride = new Vector2(0, 15); // stala wysokosc, niezale¿na od bounding box
                    minimapItem.Refresh();
                }
            }
            else
            {
                initFlag(new Vector3(0, 0, -45));
                mainNode.Translate(new Vector3(-800.0f, 5, UnitConverter.LogicToWorldUnits(firstTileIndex) + 1000));
                InitLights(new ColourValue(0.9f, 0.2f, 0.0f), new ColourValue(0.0f, 0.9f, 0.1f));
            }
        }
Beispiel #9
0
        protected override void initOnScene()
        {
            String meshName; //Nazwa modelu


            positionNode = sceneMgr.CreateSceneNode(mainNode.Name + "Static");



            //       float maxX = (Math.Abs(count) - 1) * LevelView.TileWidth / 16;


            if (tileViews != null)
            {
                positionNode.Translate(new Vector3(UnitConverter.LogicToWorldUnits(tileViews[0].LevelTile.TileIndex), -(tileViews[0].LevelTile as ShipTile).Depth, 0));
                positionNode.SetDirection(Vector3.UNIT_X);
            }


            animationNode = positionNode.CreateChildSceneNode(mainNode.Name + "Animation");
            staticNode    = animationNode.CreateChildSceneNode(mainNode.Name + "StaticNode");

            Vector3 localTranslation;
            Vector3 batteryBasePositon;



            mainNode.AddChild(positionNode);

            TypeOfEnemyShip type;

            if (backgroundDummy)
            {
                type = backgroundDummyShipType;
            }
            else
            {
                BeginShipTile begin = tileViews[0].LevelTile as BeginShipTile;
                type = begin.TypeOfEnemyShip;
            }

            switch (type)
            {
            case TypeOfEnemyShip.PatrolBoat:
                meshName           = "PatrolBoat.mesh";
                batteryBasePositon = new Vector3(0, 8.5f, -18.0f);
                localTranslation   = Vector3.ZERO;
                buildFloatAnimation(animationNode, 10, false);
                break;

            case TypeOfEnemyShip.WarShip:
                meshName           = "Warship.mesh";
                batteryBasePositon = new Vector3(0, 14.5f, -50.0f);
                localTranslation   = Vector3.ZERO;
                buildFloatAnimation(animationNode, 10, true);
                break;

            case TypeOfEnemyShip.Submarine:
                meshName           = "Submarine.mesh";
                batteryBasePositon = new Vector3(0, 8.5f, -18.0f);
                localTranslation   = new Vector3(0, 0, -15);   // okret ma srodek ciezkosci w srodku zeby animacja fajniej wygladala. Trzeba przesunac

                if (!EngineConfig.UseHydrax)
                {
                    localTranslation = new Vector3(0, 3.0f, 0);     // woda nie jest przezroczysta wiec nie widac drania
                }
                buildFloatAnimation(animationNode, 10, false);
                break;

            default:
                return;
            }

            compositeModel             = sceneMgr.CreateEntity(name, meshName);
            compositeModel.CastShadows = EngineConfig.ShadowsQuality > 0;
            staticNode.AttachObject(compositeModel);
            staticNode.Translate(localTranslation);
            float dist;

            if (backgroundDummy)
            {
                switch (type)
                {
                case TypeOfEnemyShip.PatrolBoat:
                    dist = UnitConverter.RandomGen.NextDouble() >= 0.5 ? -200.0f : 50.0f;
                    mainNode.Translate(new Vector3(dist, -1.5f, UnitConverter.LogicToWorldUnits(firstTileIndex) + 160));
                    break;

                case TypeOfEnemyShip.Submarine:
                    dist = UnitConverter.RandomGen.NextDouble() >= 0.5 ? -100.0f : 40.0f;
                    mainNode.Translate(new Vector3(dist, -4, UnitConverter.LogicToWorldUnits(firstTileIndex) + 120));
                    break;

                case TypeOfEnemyShip.WarShip:
                    dist = -700.0f;
                    mainNode.Translate(new Vector3(dist, -2, UnitConverter.LogicToWorldUnits(firstTileIndex) + 300));
                    break;
                }

                return;
            }

            bool rocketBatterySet = false;

            // elementy na statku sa animowalne wiec nie beda w static geometry
            count = tileViews.Count;
            for (int i = 0; i < count; i++)
            {
                tileViews[i].initOnScene(positionNode, i + 1, tileViews.Count);


                if (!rocketBatterySet && (tileViews[i] is ShipBunkerTileView) && (tileViews[i] as ShipBunkerTileView).HasRockets)
                {
                    rocketBatterySet = true;
                    for (int k = -3; k <= 3; k++)
                    {
                        Entity    rocketBatteryEntity = sceneMgr.CreateEntity(name + "_RocketBattery" + k, "Bazooka.mesh");
                        SceneNode rocketBatteryNode   = staticNode.CreateChildSceneNode(rocketBatteryEntity.Name + "Node", batteryBasePositon + new Vector3(k * 0.4f, 0, 0));
                        rocketBatteryNode.SetScale(3, 3, 3);
                        rocketBatteryNode.Pitch(new Radian(new Degree(30)));
                        rocketBatteryNode.AttachObject(rocketBatteryEntity);
                    }
                }
            }

            string soundFile = SoundManager3D.C_SHIP_SINKING;

            if (Mogre.Math.RangeRandom(0, 1) > 0.5f)
            {
                soundFile = SoundManager3D.C_SHIP_SINKING_2;
            }
            dieSound = SoundManager3D.Instance.CreateSoundEntity(soundFile, mainNode, false, false);
            dieSound.SetBaseGain(0.25f);

            submergingSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SHIP_SUBMERGING, mainNode, false, false);
            submergingSound.SetBaseGain(0.25f);

            emergingSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SHIP_EMERGING, mainNode, false, false);
            emergingSound.SetBaseGain(0.25f);


            // minimapa
            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(staticNode, framework.MinimapMgr, "ShipMinimap.mesh",
                                    new ColourValue(0.092f, 0.262f, 0.49f), compositeModel);

                minimapItem.ScaleOverride = new Vector2(0, 15); // stala wysokosc, niezale¿na od bounding box
                minimapItem.Refresh();
            }
        }
Beispiel #10
0
        protected override void initOnScene()
        {
            BeginIslandTile tile;

            if (tileViews != null && tileViews.Count > 0 && tileViews[0].LevelTile is BeginIslandTile)
            {
                tile     = (tileViews[0].LevelTile as BeginIslandTile);
                meshName = tile.MeshName;
            }
            if (meshName == null)
            {
                return;
            }



            float margin;

            staticNode = sceneMgr.CreateSceneNode(mainNode.Name + "Static");

            if (!backgroundDummy)
            {
                count  = tileViews.Count;
                margin = 4.5f;
            }
            else
            {
                margin = 0.3f;
            }
            float maxX = -((Math.Abs(count) - 1) * LevelView.TileWidth);


            float dummyYPosition = 0;



            string meshFilename;

            switch (meshName)
            {
            case "Island1":     //5
                //ISLAND1
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, 0.7f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, 0.7f);
                break;

            case "Island1a":     //5
                //ISLAND1
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, 0.7f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, 0.7f);
                break;

            case "IslandRound":     //4
                //ISLAND ROUND
                initNonCollisionTreesCircle(sceneMgr, staticNode, 15.0f, 1.3f);
                break;

            case "Island2":     //6
                //ISLAND2
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, 0.7f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, 0.7f);
                break;

            case "Laguna":     //7
                //LAGUNA
                break;


            case "DoubleLaguna":     //8
                // DOUBLE LAGUNA
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -5.5f, 0.0f, maxX * 0.1f, maxX, 0.6f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -1.5f, 30.0f, maxX * 0.00f, maxX * 0.15f, 0.6f);

                initNonCollisionTreesDiamond(sceneMgr, staticNode, -1.5f, 30.0f, maxX * 0.85f, maxX * 1.00f, 0.6f);

                break;

            case "Island3":     //9
                //ISLAND3
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, 0.7f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, 0.7f);
                break;

            case "Island12u":     //12
                //ISLAND12u
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, maxX / 4.0f, maxX / 2.0f, 0.5f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, maxX / 4.0f, maxX / 2.0f, 0.5f);
                break;

            case "Island4":     //13
                //ISLAND4
                initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 5, 0.7f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -5, 0.7f);
                break;

            case "Island18u":     //18
                //ISLAND18u
                initNonCollisionTreesDiamond(sceneMgr, staticNode, 10, 14, maxX / 2.5f, maxX, 0.5f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -11, -13, maxX / 2.5f, maxX, 0.5f);

                // zwolnic pamiec
                EnemyFighterView epv = new EnemyFighterView(null, framework, staticNode);
                epv.PlaneNode.SetPosition(-3, 0.8f, -18 - 90);
                epv.PlaneNode.Yaw(new Radian(new Degree(60)));
                if (EngineConfig.DisplayingMinimap)
                {
                    epv.MinimapItem.Hide();
                }
                parkedPlanes.Add(epv);

                EnemyFighterView epv2 = new EnemyFighterView(null, framework, staticNode);
                epv2.PlaneNode.SetPosition(-3, 0.8f, -25 - 90);
                epv2.PlaneNode.Yaw(new Radian(new Degree(62)));
                if (EngineConfig.DisplayingMinimap)
                {
                    epv2.MinimapItem.Hide();
                }
                parkedPlanes.Add(epv2);

                initLampPosts(staticNode, -7, maxX * 0.55f, maxX * 0.95f, 12, new Radian(new Degree(0)));
                break;


            case "Island5":     //24
                //ISLAND5

                if (backgroundDummy)
                {
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, 1, 15, 0.7f);
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, -1, -15, 0.7f);
                }
                else
                {
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, margin, 15, 0.7f);
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, -margin, -15, 0.7f);
                }
                break;

            case "Island6":     //42
                //ISLAND6
                if (EngineConfig.LowDetails)
                {
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, 4.5f, 33, 0.5f);
                }
                else
                {
                    initNonCollisionTreesDiamond(sceneMgr, staticNode, 4.5f, 33, 0.9f);
                }

                initNonCollisionTreesDiamond(sceneMgr, staticNode, -4.5f, -60, 0.5f);
                initNonCollisionTreesDiamond(sceneMgr, staticNode, -4.5f, -30, 0.5f);
                break;

            case "RadarDome":
                dummyYPosition = 21;
                break;
            }

            if (EngineConfig.LowDetails && MeshManager.Singleton.ResourceExists(meshName + "_low" + ViewHelper.C_MESH_EXT))
            {
                meshFilename = "_low" + ViewHelper.C_MESH_EXT;
            }
            else
            {
                meshFilename = meshName + ViewHelper.C_MESH_EXT;
            }


            compositeModel             = sceneMgr.CreateEntity(name, meshFilename);
            compositeModel.CastShadows = false;// EngineConfig.ShadowsQuality > 0;

            //  compositeModel.SetMaterialName("Carrier");
            //      compositeModel.SetMaterialName("Carrier/Panels");

            /*
             * Mogre.Plane mPlane = new Mogre.Plane(Vector3.UNIT_Y, new Vector3(0,Mogre.Math.RangeRandom(0,1) ,0));
             *
             * MeshManager.Singleton.CreatePlane("Myplane"+this.GetHashCode(),
             *       ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, mPlane, 1000,1000,50,50,true,1,5,5,Vector3.UNIT_Z);
             *
             * Entity pPlaneEnt = sceneMgr.CreateEntity( "plane"+this.GetHashCode(), "Myplane"+this.GetHashCode() );
             *
             * compositeModel = pPlaneEnt;
             * compositeModel.SetMaterialName("Concrete");
             */
            try
            {
                if (LevelView.IsNightScene)
                {
                    ViewHelper.ReplaceMaterial(compositeModel, "Island", "IslandNight");
                }
            }
            catch (Exception)
            {
            }



            if (!backgroundDummy)
            {
                staticNode.Translate(new Vector3(UnitConverter.LogicToWorldUnits(firstTileIndex), 1.00f, 0));
                staticNode.SetDirection(Vector3.UNIT_X);
            }
            else
            {
                float angle;

                if (meshName.Equals("Island6"))
                {
                    float X = (islandCounter % 5 * 250) - 650;
                    float Z = Math.RangeRandom(-4, 0) * 70;
                    staticNode.Translate(new Vector3(-250 + Z, dummyYPosition, Math.RangeRandom(-120, 120) + X));
                    staticNode.SetDirection(Vector3.UNIT_X);
                    angle = Math.RangeRandom(0, 2 * Math.PI);
                }
                else
                {
                    staticNode.Translate(new Vector3(-450 + Math.RangeRandom(-150, 150), dummyYPosition, Math.RangeRandom(-200, 200)));
                    staticNode.SetDirection(Vector3.UNIT_X);
                    angle = Math.HALF_PI;
                }

                staticNode.Yaw(angle);
            }
            //  StaticGeometry sg;
            staticNode.AttachObject(compositeModel);

            /*
             * if (sceneMgr.HasStaticGeometry(this.name + "_StaticGeometry"))
             * {
             *  sceneMgr.DestroyStaticGeometry(this.name + "_StaticGeometry");
             * }
             * sg = new StaticGeometry(sceneMgr, this.name + "_StaticGeometry");
             * sg.Reset();
             * Vector3 sgSize = compositeModel.BoundingBox.Size;
             * sg.RegionDimensions = sgSize;
             * sg.AddSceneNode(staticNode);
             * sg.Build();
             */

            //  mainNode.SetDirection(Vector3.UNIT_X);
            //  mainNode.Position = staticNode.Position;
            mainNode.AddChild(staticNode);


            //   mainNode.AttachObject(compositeModel);
            // elementy na wyspie sa animowalne wiec nie beda w static geometry
            if (!backgroundDummy)
            {
                for (int i = 0; i < count; i++)
                {
                    tileViews[i].initOnScene(staticNode, i + 1, count);
                }

                // minimapa
                if (EngineConfig.DisplayingMinimap)
                {
                    minimapItem =
                        new MinimapItem(staticNode, framework.MinimapMgr, "Cube.mesh",
                                        new ColourValue(1, 0.9137f, 0.29f), compositeModel);
                    minimapItem.Entity.SetMaterialName("Minimap/Island");
                    minimapItem.ScaleOverride = new Vector2(count * 10.0f, 3); // stala wysokosc wyspy, niezale¿na od bounding box
                    //   minimapItem.MinimapNode.Translate(0,0,50);
                    minimapItem.Refresh();
                }
            }
        }
Beispiel #11
0
        protected override void initOnScene()
        {
            lWingNode = innerNode.CreateChildSceneNode(name + "LWingNode", new Vector3(-8.8f, 0.0f, -1.5f));
            rWingNode = innerNode.CreateChildSceneNode(name + "RWingNode", new Vector3(8.8f, 0.0f, -1.5f));

            if (plane != null && !plane.IsEnemy)
            {
                EnableNightLights();
            }

            // main nodes init
            planeEntity             = sceneMgr.CreateEntity(name + "_Body", GetMainMeshName());
            planeEntity.CastShadows = EngineConfig.ShadowsQuality > 0;
            if (GameConsts.GenericPlane.CurrentUserPlane.PlaneCheat)
            {
                ViewHelper.ReplaceMaterial(planeEntity, bodyMaterialName, "P47/BodyPL");
                bodyMaterialName = "P47/BodyPL";
            }



            innerNode.AttachObject(planeEntity);
            outerNode.Scale(new Vector3(0.4f, 0.4f, 0.4f));



            torpedoHolder = innerNode.CreateChildSceneNode(planeNode.Name + "TorpedoHolder", new Vector3(0, -1.6f, 1.6f));
            if (plane != null)
            {
                /*  if (this.plane.Direction == Direction.Right)
                 * {
                 *    torpedoHolder.Orientation = new Quaternion(Math.HALF_PI, Vector3.NEGATIVE_UNIT_Y);
                 * }
                 * else
                 * {
                 *    torpedoHolder.Orientation = new Quaternion(Math.HALF_PI, Vector3.UNIT_Y);
                 *
                 * } */
                torpedoHolder.Scale(2.5f, 2.5f, 2.5f); // caly node jest skalowany x 0.4
                Entity torpedo = sceneMgr.CreateEntity(name + "_Torpedo", "Torpedo.mesh");
                torpedoHolder.AttachObject(torpedo);
            }



            // torpedoHolder.SetVisible(false);


            ViewHelper.AttachAxes(sceneMgr, innerNode, 1.5f);

            refreshPosition();
            base.initOnScene();

            if (this.plane != null && this.plane.WheelsState == WheelsState.In)
            {
                this.animationMgr.switchToGearUpDown(false);
                this.animationMgr.CurrentAnimation.Enabled = false;
                animationMgr.disableAll();
            }



            if (plane != null && plane.LocationState == LocationState.Air)
            {
                animationMgr.switchToIdle();
            }
            animationMgr.enableBlade();


            if (EngineConfig.DisplayingMinimap)
            {
                minimapItem =
                    new MinimapItem(outerNode, this.frameWork.MinimapMgr, "Cube.mesh", new ColourValue(0, 0.9f, 0),
                                    planeEntity);
                minimapItem.ScaleOverride = new Vector2(0, 5);
                minimapItem.MinimapNode.Translate(0, 0, 10.0f);
                minimapItem.Refresh();
            }
            // kamery



            ResetCameraHolders();
        }
Beispiel #12
0
        protected void preInitOnScene()
        {
            soldierModel = sceneMgr.CreateEntity("Soldier" + soldierID.ToString(), "Soldier.mesh");

            soldierNode =
                sceneMgr.RootSceneNode.CreateChildSceneNode("SoldierNode" + soldierID.ToString(),
                                                            new Vector3(-1000000, -1000000, 0));

            if (EngineConfig.SoundEnabled)
            {
                float rand = Math.RangeRandom(0.0f, 5.0f);
                if (rand >= 0 && rand < 1.0)
                {
                    dieSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SOLDIER_DIE_1, soldierNode, false, false);
                    dieSound.SetBaseGain(3.5f);
                }
                else if (rand >= 1 && rand < 2.0)
                {
                    dieSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SOLDIER_DIE_2, soldierNode, false, false);
                    dieSound.SetBaseGain(4.0f);
                }
                else
                if (rand >= 2 && rand < 3.0)
                {
                    dieSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SOLDIER_DIE_3, soldierNode, false, false);
                    dieSound.SetBaseGain(3.0f);
                }
                else if (rand >= 3 && rand < 4.0)
                {
                    dieSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SOLDIER_DIE_4, soldierNode, false, false);
                    dieSound.SetBaseGain(2.0f);
                }
                else
                {
                    dieSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_SOLDIER_DIE_5, soldierNode, false, false);
                    dieSound.SetBaseGain(2.0f);
                }
                dieSound.SetReferenceDistance(60); // make it a bit louder but dissapear faster

                //  prepareToFireSound = SoundManager3D.Instance.CreateSoundEntity(SoundManager3D.C_MISSILE_LOCK, soldierNode, true, false);
            }


            soldierNode.AttachObject(soldierModel);
            soldierNode.Scale(1.3f, 1.35f, 1.3f);
            runAnimationState           = soldierModel.GetAnimationState("run");
            die1AnimationState          = soldierModel.GetAnimationState("die1");
            die2AnimationState          = soldierModel.GetAnimationState("die2");
            prepareToFireAnimationState = soldierModel.GetAnimationState("prepareToFire");

            soldierNode.SetVisible(false);

            if (EngineConfig.DisplayingMinimap)
            {
                if (minimapItem == null)
                {
                    minimapItem =
                        new MinimapItem(soldierNode, framework.MinimapMgr, "Cube.mesh", new ColourValue(0.97f, 1.0f, 0.66f),
                                        soldierModel);
                    minimapItem.ScaleOverride = new Vector2(4, 7); // stala wysokosc bunkra, niezale¿na od bounding box
                }
                minimapItem.Refresh();
                minimapItem.Hide();
            }
        }