Esempio n. 1
0
        public virtual void postInitOnScene()
        {
            if (EngineConfig.ExplosionLights && LevelView.IsNightScene)
            {
                string lightName = "Ammunition" + GetHashCode() + "_light";

                if (sceneMgr.HasLight(lightName))
                {
                    explosionFlash = sceneMgr.GetLight(lightName);
                }
                else
                {
                    explosionFlash = sceneMgr.CreateLight(lightName);
                }

                explosionFlash.Type = Light.LightTypes.LT_POINT;
                explosionFlash.SetAttenuation(15f, 0f, 1f, 0f);
                explosionFlash.DiffuseColour  = new ColourValue(0.7f, 0.7f, 0.7f);
                explosionFlash.SpecularColour = new ColourValue(0.3f, 0.3f, 0.3f);
                explosionFlash.Visible        = false;
                explosionFlash.CastShadows    = false;
            }
            else
            {
                explosionFlash = null;
            }

            SceneNode flashNode = ammunitionNode.CreateChildSceneNode(new Vector3(0f, 2.5f, 0f));


            if (EngineConfig.ExplosionLights && LevelView.IsNightScene)
            {
                if (!explosionFlash.IsAttached)
                {
                    flashNode.AttachObject(explosionFlash);
                }

                explosionFlash.SetAttenuation(15f, 0f, 1f, 0f);
                explosionFlash.DiffuseColour  = new ColourValue(0.7f, 0.7f, 0.7f);
                explosionFlash.SpecularColour = new ColourValue(0.3f, 0.3f, 0.3f);
            }

            if (EngineConfig.DisplayingMinimap && minimapItem != null)
            {
                minimapItem.Show();
            }
            refreshPosition();

            ammunitionNode.SetVisible(true, false);
            if (EngineConfig.ExplosionLights && LevelView.IsNightScene)
            {
                explosionFlash.Visible = false;
            }

            ammunitionNode._update(true, false);
            // inaczej bounding box zajmuje cala przestrzen zawarta miedzy starym polozeniem pocisku (-100000, -1000 costam) a nowym. Niszczy to cienie
        }
Esempio n. 2
0
        protected virtual void postInitOnScene()
        {
            // dopiero teraz wiemy jaki to ¿o³nierz
            if (Soldier is General)
            {
                soldierModel.SetMaterialName("General");
            }
            else if (Soldier is Seaman)
            {
                //case Soldier.SoldierType.SEAMAN:
                soldierModel.SetMaterialName("Seaman");
            }
            else
            {
                // na razie zwykli zolnierze tez sa seaman
                soldierModel.SetMaterialName("Seaman");
            }

            if (soldier.HasBazooka)
            {
                Quaternion q = new Quaternion(new Radian(new Degree(90)), Vector3.NEGATIVE_UNIT_X);
                if (!sceneMgr.HasEntity(this.soldierID + "Bazooka"))
                {
                    weapon = sceneMgr.CreateEntity(this.soldierID + "Bazooka", "Bazooka.mesh");
                    soldierModel.AttachObjectToBone("Bip01 R Hand", weapon, q, new Vector3(0.07f, 0, 0));
                }
            }

            Run();
            refreshPosition();
            soldierNode.SetVisible(true);
            if (EngineConfig.DisplayingMinimap && minimapItem != null)
            {
                minimapItem.Show();
            }
        }