void view1_OnRender(object sender, EventArgs e)
        {
            if (!MainPlayer.Controller.LockCameraView)
            {
                Point windowPnt     = new Point(this.Left, this.Top);
                Point relativePoint = view1.TransformToAncestor(this).Transform(new Point(0, 0));
                Point p             = new Point(windowPnt.X + relativePoint.X + view1.ActualWidth / 2, windowPnt.Y + relativePoint.Y + view1.ActualHeight / 2);
                WeatherGame.RenderLoop.NativeMethods.SetCursorPos((int)p.X, (int)p.Y);
                Mouse.SetCursor(Cursors.None);

                MainPlayer.Update();
            }

            if (Global.GlobalSettings.RenderGrid)
            {
                SlimDX.Matrix mGridWorld = WorldSpace.GetRealWorldMatrixGrid(Rendering.Grid.Position, GlobalSettings.CurrentCell);
                Rendering.Grid.Draw(mGridWorld);

                SlimDX.Matrix mWorld = WorldSpace.GetRealWorldMatrix(Vector3.Zero, GlobalSettings.CurrentCell);
                Gizmo.DrawOrigin(mWorld);
            }

            if (GlobalSettings.RenderLights && GlobalSettings.RenderVolumes && GlobalSettings.CurrentObjRef != null && GlobalSettings.CurrentObjRef.BaseGameObject is Light)
            {
                Light l = GlobalSettings.CurrentObjRef.BaseGameObject as Light;
                l.RenderDebugLightVolume(GlobalSettings.CurrentObjRef, GlobalSettings.CurrentObjRef.CellContainer, Global.GlobalSettings.GridColor);
            }


            App.Tick();
        }
Exemple #2
0
        //①Form.OnLoadをオーバーライドする。
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e); //RenderFormはOnLoad内で3DCG空間を初期化しているため、base.OnLoadがOnLoad内で一番初めに呼ぶべきである。

            //ファイルを開くダイアログ
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "pmxモデルファイル(*.pmx)|*.pmx";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //ダイアログの返値がOKの場合、モデルの読み込み処理をする


                //②モデルを読み込む
                PMXModel model = PMXModelWithPhysics.OpenLoad(ofd.FileName, RenderContext);//MMDModel MMDModelWithPhysics.OpenLoad(string ファイル名,RenderContext);となっています
                //以下のように書けば、物理演算を無効にして読み込むことも可能
                //MMDModel model=MMDModel.OpenLoad(ofd.FileName, RenderContext);
                //RenderContextはカメラの情報やデバイスの情報など3DCG描画に必要な変数である。RenderFormを継承している場合、メンバー変数として利用可能である。
                //基本的にモデルなどの読み込みが必要なものは、DirectX11デバイスの情報などを保持するRenderContextの値を要求する場合が多い。

                //③ワールド空間にモデルを追加する
                WorldSpace.AddResource(model);
                //WorldSpaceは、このフォームの描画する3D空間を示している。ここにモデルなど(IDrawableを実装している)ものを渡すと、描画してくれる。
                //WorldSpaceは、ScreenContext.WorldSpaceと常に等しい。ウィンドウごとに必要な3DCG描画に必要な情報はScreenContextに保管されている。
            }
        }
 /// <summary>
 ///     WorldSpaceの内容を描画します.
 /// </summary>
 public void Render()
 {
     Context.SetRenderScreen(this);
     MoveCameraByCameraMotionProvider();
     Context.ClearScreenTarget(BackgroundColor);
     WorldSpace.DrawAllResources(HitChecker);
 }
Exemple #4
0
    public static Planet CreatePlanet(Vector3 pos, string pname, int idx, WorldSpace space, SPlanetConfig config)
    {
        GameObject p  = GameObject.Instantiate(space.planetPrefab);
        Planet     pl = p.GetComponent <Planet>();

        p.transform.position = pos;
        p.transform.SetParent(space.transform);
        p.transform.localScale = config.scale;
        p.name          = pname; //"Planet_" + idx;
        config.obj      = p;
        config.resource = ERESOURCE.FUEL;
        switch (config.celestType)
        {
        case ECELESTIALTYPE.PLANET:
            float rand = UnityEngine.Random.Range(0f, 1f);
            if (rand > 0.6f)
            {
                config.resource = ERESOURCE.INVESTIGATION;
            }
            break;

        default:
            break;
        }
        pl.SetConfig(config);
        Material t = space.GetPlanetMaterial(config.celestType);

        p.GetComponent <MeshRenderer>().material = t;
        GameObject.DestroyImmediate(p.GetComponent <SphereCollider>());
        return(pl);
    }
Exemple #5
0
        public static void UpdateMeshMatrix(GameObjectReference gm)
        {
            if (gm.PhysicsObj == null)
            {
                return;
            }

            Model model = gm.BaseGameObject as Model;

            if (model.StaticMesh)
            {
                Cell            c            = WorldData.GetObject(gm.CellContainerId) as Cell;
                AffineTransform entityMatrix = new AffineTransform(gm.Scale, Quaternion.RotationMatrix(gm.Rotation), WorldSpace.GetRealWorldPos(gm.Position, c));

                InstancedMesh sm = gm.PhysicsObj as InstancedMesh;
                sm.WorldTransform  = entityMatrix;
                gm.EntityTransform = entityMatrix.Matrix;
                sm.UpdateBoundingBox();
            }
            else
            {
                if (!Paused)
                {
                    return;
                }

                Cell   c            = WorldData.GetObject(gm.CellContainerId) as Cell;
                Matrix entityMatrix = gm.Rotation * Matrix.Translation(WorldSpace.GetRealWorldPos(gm.Position, c));

                Entity mm = gm.PhysicsObj as Entity;
                mm.WorldTransform  = entityMatrix;
                gm.EntityTransform = entityMatrix;
            }
        }
Exemple #6
0
        public UnitBase(WorldSpace ws, int templateID, int campID, int level)
        {
            this.ID          = id;
            this.mWorldSpace = ws;
            this.TemplateID  = templateID;
            this.CampID      = campID;
            var config = ConfigManager.Unit.getRow(templateID);

            this.HP     = config.MaxHP;
            this.MaxHP  = config.MaxHP;
            this.IsDead = false;

            ATK            = new Attribute(config.Attack, null);
            radius         = config.Radius;
            MoveSpeed      = new Attribute(config.MoveSpeed, null);
            AttackDuration = new AttackDuration(config.AttackDuration, null);
            AttackRange    = new DistanceAttribute(config.AttackRange, null);
            VisualRange    = new DistanceAttribute(config.VisualRange, null);
            Bullet         = config.Bullet;
            if (config.Skills != null)
            {
                mSkills = new Skill[config.Skills.Length];
            }
            else
            {
                mSkills = new Skill[0];
            }
            for (int i = 0; i < mSkills.Length; ++i)
            {
                mSkills[i] = new Skill(this, config.Skills[i], level);
            }
            InitController();
            InitBehaviorTree();
            Animator = new AnimatorController(config.Animator);
        }
Exemple #7
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ScreenContext.CameraMotionProvider = new BasicCameraControllerMotionProvider(this, this);
            BasicGrid grid = new BasicGrid();

            grid.Load(RenderContext);
            WorldSpace.AddResource(grid);
            bulletPhysics = new BulletPhysics(new Vector3(0, -9.8f, 0f));
            ground        = bulletPhysics.CreatePlane(0, Matrix.Identity);
            ball_Model    = MMDModel.OpenLoad("1.pmx", RenderContext);
            ball_Model2   = MMDModel.OpenLoad("1.pmx", RenderContext);
            RigidBodyData data = ball_Model.Model.RigidBodyList.RigidBodies[0];

            ball  = bulletPhysics.CreateSphere(data.Size.X, Matrix.Translation(-15, 12f, 0), 1f, 1f, 0f);
            ball2 = bulletPhysics.CreateSphere(data.Size.X, Matrix.Translation(15, 12f, 0), 1f, 1f, 0f);

            rigid2model = GetModelWorldFromRigid();

            WorldSpace.AddResource(ball_Model);
            WorldSpace.AddResource(ball_Model2);
            CreateWalls();
            ball.ApplyCentralImpulse(new Vector3(2, 0.01f, 0f));
            ball2.ApplyCentralImpulse(new Vector3(-2, 0, 0));
            brush  = SpriteBatch.CreateSolidColorBrush(Color.Brown);
            format = SpriteBatch.CreateTextformat("Meiriyo", 30);
            format.Format.ParagraphAlignment = ParagraphAlignment.Center;
            format.Format.TextAlignment      = TextAlignment.Center;
            timer1.Start();
        }
Exemple #8
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (objectToEdit == null)
            {
                objectToEdit = new WorldSpace();
            }

            WorldSpace obj = objectToEdit as WorldSpace;

            obj.BaseObjectId   = txtBaseObjectId.Text;
            obj.BaseObjectName = txtBaseObjectName.Text;
            obj.DataFileName   = txtDataFileName.Text;

            obj.Category = objCategory;
            bool success = isEditingObj ? WorldData.UpdateObject(obj) : WorldData.AddObject(obj);

            if (!success)
            {
                MessageBox.Show(Application.Current.MainWindow, "ID already exists", "AddObject Failure", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.Cancel);
            }
            else
            {
                this.Close();
                if (parentWindow != null)
                {
                    parentWindow.Refresh();
                }
            }
        }
Exemple #9
0
        public void Covariance()
        {
            WorldSpace2D a = new WorldSpace2D(10, 20);
            WorldSpace   b = a;

            Assert.That(b.Z, Is.EqualTo(0));
            Assert.That(b.X, Is.EqualTo(10));
            Assert.That(b.Y, Is.EqualTo(20));

            WorldSpace   c = new WorldSpace(10, 20, 0);
            WorldSpace2D d = c;

            Assert.That(d.X, Is.EqualTo(10));
            Assert.That(d.Y, Is.EqualTo(20));

            WorldSpace e = (10, 20, 0);

            Assert.That(e.X, Is.EqualTo(10));
            Assert.That(e.Y, Is.EqualTo(20));
            Assert.That(e.Z, Is.EqualTo(0));

            WorldSpace2D f = (10, 20);

            Assert.That(f.X, Is.EqualTo(10));
            Assert.That(f.Y, Is.EqualTo(20));

            Assert.That(a == b); Assert.That(b == a);
            Assert.That(b == c); Assert.That(c == b);
            Assert.That(c == d); Assert.That(d == c);
            Assert.That(d == f); Assert.That(f == d);
        }
Exemple #10
0
        //①Overrides Form.OnLoad method
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e); //You should call base.Load(e); at first line of this method when you override OnLoad method.

            //Use OpenFileDialog
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "pmx model file(*.pmx)|*.pmx";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //Load model when ShowDialog result is DialogResult.OK


                //②Load Model
                MMDModel model = MMDModelWithPhysics.OpenLoad(ofd.FileName, RenderContext);//MMDModel MMDModelWithPhysics.OpenLoad(string fileName,RenderContext);
                //When you want to disable physics calclation,you can do that by using the static method below.
                //MMDModel model=MMDModel.OpenLoad(ofd.FileName, RenderContext);
                //RenderContext contains device data,direct2D device data..and so on using for rendering 3DCG world. If the class  extends RenderForm,you can use this field as RenderContext.
                //The method or classes rendering something sometimes require this value.

                //③Add model to world.
                WorldSpace.AddResource(model);
                //WorldSpace manages the models added to world. If you add a drawable obeject to WorldSpace,the object will be rendered.
            }
        }
Exemple #11
0
 public CircleRegion(WorldSpace w, float x, float y, float r)
 {
     this.world = w;
     this.x     = x;
     this.y     = y;
     this.r     = r;
 }
Exemple #12
0
        //①Form.OnLoadをオーバーライドする。
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e); //The RenderForm Initializes the 3D space within the OnLoad for the base.OnLoadがOnLoad内で一番初めに呼ぶべきである。

            //The file open dialog
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "pmxモデルファイル(*.pmx)|*.pmx";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //OK if the return value of the dialog to model loading process


                //②モデルを読み込む
                PMXModel model = PMXModelWithPhysics.OpenLoad(ofd.FileName, RenderContext);//MMDModel MMDModelWithPhysics.OpenLoad(string ファイル名,RenderContext);となっています
                //Possible to disable physics if you write the following in the load
                //MMDModel model=MMDModel.OpenLoad(ofd.FileName, RenderContext);
                //RenderContext is required to draw the camera or device information, including 3D variable。RenderFormを継承している場合、メンバー変数として利用可能である。
                //To request the value of RenderContext DirectX11 device information to hold a basically loads, such as those that require a lot。

                //③ワールド空間にモデルを追加する
                WorldSpace.AddResource(model);
                //WorldSpace shows the 3D space to draw on this form.。ここにモデルなど(IDrawableを実装している)ものを渡すと、描画してくれる。
                //WorldSpace is a ScreenContext.WorldSpaceと常に等しい。ウィンドウごとに必要な3DCG描画に必要な情報はScreenContextに保管されている。
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    context = null;
                }

                if (WorldSpace != null)
                {
                    WorldSpace.Dispose();
                    WorldSpace = null;
                }

                if (renderTargetView != null && !renderTargetView.Disposed)
                {
                    renderTargetView.Dispose();
                }
                if (renderTarget != null && !renderTarget.Disposed)
                {
                    renderTarget.Dispose();
                }
                if (depthTargetView != null && !depthTargetView.Disposed)
                {
                    depthTargetView.Dispose();
                }
                if (depthTarget != null && !depthTarget.Disposed)
                {
                    depthTarget.Dispose();
                }

                disposed = true;
            }
        }
    void Start()
    {
        sr = GetComponent <SpriteRenderer>();

        Generate();
        transform.position = WorldSpace.RandomPosition();
    }
Exemple #15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "pmxモデルファイル(*.pmx)|*.pmx";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                PMXModel model = PMXModelWithPhysics.OpenLoad(ofd.FileName, RenderContext);

                OpenFileDialog ofd2 = new OpenFileDialog();
                ofd2.Filter = "vmdモーションファイル(*.vmd)|*.vmd";
                if (ofd2.ShowDialog() == DialogResult.OK)
                {
                    IMotionProvider motion = model.MotionManager.AddMotionFromFile(ofd2.FileName, true);
                    model.MotionManager.ApplyMotion(motion, 0, ActionAfterMotion.Replay);
                }
                WorldSpace.AddResource(model);
                //③ カメラモーションの選択ダイアログを表示し、選ばれたものをScreenContext.CameraMotionProviderに代入する。
                CameraControlSelector selector = new CameraControlSelector(model);
                selector.ShowDialog(this);
                ScreenContext.CameraMotionProvider = selector.ResultCameraMotionProvider;

                /*
                 * ScreenContext.CameraMotionProviderに代入されたインターフェースのUpdateCameraが毎回呼ばれることによりカメラを更新している。
                 * この変数の型はICameraMotionProviderのため、これを実装すればカメラの動きは容易に定義可能である。
                 */
            }
        }
Exemple #16
0
        public static void AddMeshToSpace(GameObjectReference m, Cell c)
        {
            Model model = m.BaseGameObject as Model;

            if (model.StaticMesh)
            {
                InstancedMeshShape sms = null;
                if (staticMeshShapeCache.ContainsKey(model.Mesh3d.meshFileName))
                {
                    sms = staticMeshShapeCache[model.Mesh3d.meshFileName];
                }
                else
                {
                    Vector3[] verts    = model.Mesh3d.GetMeshVertices();
                    int[]     indecies = model.Mesh3d.GetMeshIndices();
                    sms = new InstancedMeshShape(verts, indecies);
                    staticMeshShapeCache.Add(model.Mesh3d.meshFileName, sms);
                }


                AffineTransform entityMatrix = new AffineTransform(m.Scale, Quaternion.RotationMatrix(m.Rotation), WorldSpace.GetRealWorldPos(m.Position, c));
                InstancedMesh   mm           = new InstancedMesh(sms, entityMatrix);
                mm.Tag = m;
                mm.ImproveBoundaryBehavior = true;
                mm.Sidedness = BEPUphysics.CollisionShapes.ConvexShapes.TriangleSidedness.Clockwise;
                PhysicsEngine.Space.Add(mm);
                m.PhysicsObj      = mm;
                m.EntityTransform = entityMatrix.Matrix;
            }
            else
            {
                MobileMeshShape mms = null;
                ShapeDistributionInformation shapeInfo;
                if (mobileMeshShapeCache.ContainsKey(model.Mesh3d.meshFileName))
                {
                    mms       = mobileMeshShapeCache[model.Mesh3d.meshFileName];
                    shapeInfo = mobileMeshInfoCache[model.Mesh3d.meshFileName];
                }
                else
                {
                    Vector3[] verts    = model.Mesh3d.GetMeshVertices();
                    int[]     indecies = model.Mesh3d.GetMeshIndices();
                    mms = new MobileMeshShape(verts, indecies, AffineTransform.Identity, MobileMeshSolidity.Solid, out shapeInfo);
                    mobileMeshShapeCache.Add(model.Mesh3d.meshFileName, mms);
                    mobileMeshInfoCache.Add(model.Mesh3d.meshFileName, shapeInfo);
                }
                mms.Sidedness = BEPUphysics.CollisionShapes.ConvexShapes.TriangleSidedness.Clockwise;


                Matrix mWorld = m.Rotation * Matrix.Translation(WorldSpace.GetRealWorldPos(m.Position, c));
                Entity e      = new Entity(mms, 10);
                e.CollisionInformation.LocalPosition = shapeInfo.Center;
                e.WorldTransform     = mWorld;
                e.Tag                = m;
                e.PositionUpdateMode = PositionUpdateMode.Continuous;
                PhysicsEngine.Space.Add(e);
                m.PhysicsObj      = e;
                m.EntityTransform = mWorld;
            }
        }
Exemple #17
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "pmxモデルファイル(*.pmx)|*.pmx";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                PMXModel model = PMXModelWithPhysics.OpenLoad(ofd.FileName, RenderContext);

                OpenFileDialog ofd2 = new OpenFileDialog();
                ofd2.Filter = "vmdモーションファイル(*.vmd)|*.vmd";
                if (ofd2.ShowDialog() == DialogResult.OK)
                {
                    IMotionProvider motion = model.MotionManager.AddMotionFromFile(ofd2.FileName, true);
                    model.MotionManager.ApplyMotion(motion, 0, ActionAfterMotion.Replay);
                }

                WorldSpace.AddResource(model);
                //②コントローラーフォームに対して読み込んだモデルを渡して表示します。
                Controller controller = new Controller(model);
                controller.Show();
            }
        }
        public override void Draw(GraphicsDevice device, WorldState world)
        {
            Avatar.Position = WorldSpace.GetWorldFromTile(Position);
            var headpos   = Avatar.Skeleton.GetBone("HEAD").AbsolutePosition / 3.0f;
            var tHead1    = Vector3.Transform(new Vector3(headpos.X, headpos.Z, headpos.Y), Matrix.CreateRotationZ((float)(RadianDirection + Math.PI)));
            var transhead = tHead1 + this.Position - new Vector3(0.5f, 0.5f, 0f);

            if (!Visible)
            {
                return;
            }

            if (Avatar != null)
            {
                Color col = Color.White;
                if ((DisplayFlags & AvatarDisplayFlags.ShowAsGhost) > 0)
                {
                    col = new Color(32, 255, 96) * 0.66f;
                }
                else if (IsDead)
                {
                    col = new Color(255, 255, 255, 64);
                }

                Avatar.LightPositions = (WorldConfig.Current.AdvancedLighting)?CloseLightPositions(Position):null;
                var newWorld = Matrix.CreateRotationY((float)(Math.PI - RadianDirection)) * this.World;
                if (Scale != 1f)
                {
                    newWorld = Matrix.CreateScale(Scale) * newWorld;
                }
                world._3D.DrawMesh(newWorld, Avatar, (short)ObjectID, (Room > 65532 || Room == 0)?Room:blueprint.Rooms[Room].Base, col, Level);
            }

            if (Headline != null && !Headline.IsDisposed)
            {
                var headOff = (transhead - Position) + new Vector3(0, 0, 0.66f);
                if (world is WorldStateRC)
                {
                    //this is done in world2DRC, after everything else.
                }
                else
                {
                    var headPx = world.WorldSpace.GetScreenFromTile(headOff);

                    var item = world._2D.NewSprite(_2DBatchRenderMode.Z_BUFFER);
                    item.Pixel = Headline;
                    item.Depth = TextureGenerator.GetWallZBuffer(device)[30];

                    item.SrcRect       = new Rectangle(0, 0, Headline.Width, Headline.Height);
                    item.WorldPosition = headOff;
                    var off = PosCenterOffsets[(int)world.Zoom - 1];
                    item.DestRect = new Rectangle(
                        ((int)headPx.X - Headline.Width / 2) + (int)off.X,
                        ((int)headPx.Y - Headline.Height / 2) + (int)off.Y, Headline.Width, Headline.Height);
                    item.Room = Room;
                    world._2D.Draw(item);
                }
            }
        }
        public bool InitBattle(int campCount)
        {
            var n_world = new WorldSpace();

            n_world.Init(100, 100, 5, 60);

            return(InitBattle(campCount, n_world));
        }
Exemple #20
0
 public WorldSpace(WorldSpace other)
 {
     gold              = other.gold;
     cannon            = other.cannon;
     hasDefense        = other.hasDefense;
     defenseIsRepaired = other.defenseIsRepaired;
     enemyLife         = other.enemyLife;
     bullet            = other.bullet;
 }
Exemple #21
0
        public SerializableGamedData(SerializationInfo info, StreamingContext ctxt)
        {
            string worldObjId = info.GetString("worldObjId");

            ws = WorldData.GetObject(worldObjId) as WorldSpace;
            foreach (Cell c in ws.AllCells)
            {
                c.CellObjectRefs = (Dictionary <String, GameObjectReference>)info.GetValue(c.BaseObjectId + "-objRefs", typeof(Dictionary <String, GameObjectReference>));
            }
        }
Exemple #22
0
 public SectorRegion(WorldSpace w, float x, float y, float rx, float ry, float radius, float theta)
 {
     this.world  = w;
     this.x      = x;
     this.y      = y;
     this.rx     = rx;
     this.ry     = ry;
     this.radius = radius;
     this.theta  = theta;
 }
Exemple #23
0
 public RectRegion(WorldSpace w, float x, float y, float rx, float ry, float width, float height)
 {
     this.world  = w;
     this.x      = x;
     this.y      = y;
     this.rx     = rx;
     this.ry     = ry;
     this.width  = width;
     this.height = height;
 }
Exemple #24
0
    public override bool Equals(object value)
    {
        WorldSpace other = value as WorldSpace;

        return(gold == other.gold &&
               bullet == other.bullet &&
               hasDefense == other.hasDefense &&
               defenseIsRepaired == other.defenseIsRepaired &&
               cannon == other.cannon &&
               enemyLife == other.enemyLife);
    }
 public bool InitBattle(int campCount, WorldSpace world)
 {
     this.world  = world;
     mClampGroup = new List <UnitBase> [campCount];
     for (int i = 0; i < campCount; ++i)
     {
         mClampGroup[i] = new List <UnitBase>();
     }
     GameTimeElapsed = 0;
     return(true);
 }
Exemple #26
0
 public void Init(WorldSpace ws)
 {
     fuel               = 1f;
     investigation      = 0f;
     m_WorldSpace       = ws;
     m_HomePlanet       = ws.homePlanet;
     m_HomePlanetCoords = m_HomePlanet.trf.position;
     closestPlanet      = ScanClosestPlanet(1)[0];
     m_Trf              = transform;
     m_UpdateMethod     = _IdleUpdate;
 }
Exemple #27
0
        private static Matrix GetLightVolumeWorldMatrix()
        {
            float  fScale = LightningRadius * 1.1f;
            Matrix scale, translate, world = Matrix.Identity;

            translate = WorldSpace.GetRealWorldMatrix(LightningPos, MainPlayer.CurrentCell);
            scale     = Matrix.Scaling(fScale, fScale, fScale);
            world     = Matrix.Multiply(world, scale);
            world     = Matrix.Multiply(world, translate);
            return(world);
        }
Exemple #28
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     if (objectToEdit != null && objectToEdit is WorldSpace)
     {
         WorldSpace obj = objectToEdit as WorldSpace;
         txtBaseObjectId.Text      = obj.BaseObjectId;
         txtBaseObjectName.Text    = obj.BaseObjectName;
         txtDataFileName.Text      = obj.DataFileName;
         isEditingObj              = true;
         txtBaseObjectId.IsEnabled = false;
     }
 }
    private void Generate()
    {
        transform.position = WorldSpace.RandomRHS();

        Color newColour = (1f - baseColourRatio) * Random.ColorHSV()
                          + baseColourRatio * baseColour;

        newColour.a = 1.0f;
        sr.color    = newColour;

        extraDistance = Random.Range(0, maxExtraDistance);
    }
Exemple #30
0
    // Use this for initialization
    void Start()
    {
        if (PlayerPrefs.HasKey("Max Fizzyo Pressure"))
        {
            maxBreath = PlayerPrefs.GetFloat("Max Fizzyo Pressure");
        }

        maxY               = WorldSpace.topBound - 1;
        minY               = WorldSpace.bottomBound + 1;
        movingDown         = true;
        transform.position = new Vector2(WorldSpace.leftBound + 1, WorldSpace.RandomY());

        shootController = GetComponentInChildren <ShootController>();
    }