Пример #1
0
        public override void Tick(float dtime)
        {
            if (Local)
                Server.Tick(dtime);

            base.Tick(dtime);

            Log.Tick(dtime);

            if (MusicChannel != null && Music!=null)
            {
                if (!Root.Instance.UserInterface.Audio.IsPlaying(MusicChannel))
                {
                    MusicChannel = MainCamera.PlaySound(Music, true);
                }
            }

            if (Rule == null)
            {
                Rule = Root.Instance.Scene.FindEntityByType<GameRule>();
                if (Rule != null)
                {
                    //Rule.AnnounceEvent += ControlMenu.Comm.WriteLine;
                }
            }
            if (NeedInit)
            {
                if (Root.Instance.Scene.FindEntityByType<Map>() != null)
                {
                    Init();
                    NeedInit = false;
                }
                else return;
            }

            if (!Spectate)
            {
                Control.Tick(dtime);
                if (playership.Kill)
                {
                    TimeToSpawn -= dtime;
                    if (TimeToSpawn <= 0)
                    {
                        SpawnShip();
                    }
                }
            }
            MainCamera.Tick(dtime);

            if(Root.Instance.UserInterface!=null)
                UpdateCursorPosition(GetMouseVector());

            if (playership != null && Rule is Race)
            {
                CheckPoint cp = ((Race)Rule).GetNextCheckPoint((RacePlayer)Player);
                if (cp != null)
                {
                    Vector3 dir = cp.AbsolutePosition - playership.AbsolutePosition;
                    dir.Normalize();
                    dir *= 200;
                    Arrow.Position = playership.AbsolutePosition + dir;
                    Arrow.LookAt(cp.AbsolutePosition);
                    Arrow.Visible = true;
                }
                else
                    Arrow.Visible = false;
            }
            else
                Arrow.Visible = false;

            if (Spectate)
            {

            }
            else
            {
                if (playership != null && !playership.Kill && playership.Computer.Target != null)
                {
                    //valid target
                    TargetMarker.Visible = true;
                    TargetMarker.Attach = playership.Computer.Target;
                }
                else
                {
                    //no target
                    TargetMarker.Visible = false;
                }
            }
        }
Пример #2
0
 public void Stop(Channel channel)
 {
     FMOD.RESULT result = ((FmodChannel)channel).channel.stop();
     //ERRCHECK(result);
 }
Пример #3
0
        public override void Start()
        {
            base.Start();

            Node n;
            Root client = Root.Instance;

            if (Demo != null && Demo != "")
            {
                client.Player = new DemoPlayer(Demo);
                DemoControl dc = new DemoControl();
                dc.Position = new Vector2(0, 40);
                dc.Size = new Vector2(500, 30);
                Root.Instance.Gui.windows.Add(dc);
            }
            else if (!Local)
            {
                Root.Instance.Scene.Clear();
                client.ClientConnect(Host);
            }

            if (Local)
            {
                Root.Instance.Authoritive = true;
                Server.Start();
            }
            MainCamera = new OverviewCamera();
            if (Root.Instance.UserInterface != null)
                MainCamera.Aspect = (float)Root.Instance.UserInterface.Renderer.Size.X / (float)Root.Instance.UserInterface.Renderer.Size.Y;
            Root.Instance.LocalObjects.Add(MainCamera);

            if(Music!=null)
                MusicChannel = MainCamera.PlaySound(Music, true);

            /*if (Spectate)
            {
                Root.Instance.LocalObjects.Add(new Reporter());
            }*/

            Root.Instance.Scene.camera = MainCamera;
            //Root.Instance.Scene.camera2 = FlyByCamera;

            n = new Node();
            //n.Draw.Add(new Cursor(new Color3f(0, 1, 0), 100));
            n.Draw.Add(Root.Instance.ResourceManager.LoadMesh("cursor01/cursor01.mesh"));
            Root.Instance.Scene.Spawn(n);
            n.Transparent = 1;
            n.rotationspeed = new Vector3(0, 90.0f / 180.0f * (float)Math.PI, 0);
            n.NoReplication = true;
            cursor = n;

            //ChatWindow = new Chat(null);
            //Root.Instance.Gui.windows.Add(ChatWindow);

            n = new Node();
            n.Draw.Add(Root.Instance.ResourceManager.LoadMesh("arrow1/arrow1.mesh"));
            Root.Instance.Scene.Spawn(n);
            n.NoReplication = true;
            Arrow = n;
        }
Пример #4
0
 public void SetPosition(Channel channel, Vector3 pos)
 {
     FMOD.RESULT result;
     FMOD.VECTOR pos2;
     FMOD.VECTOR vel2 = new FMOD.VECTOR();
     pos2.x = pos.X;
     pos2.y = pos.Y;
     pos2.z = pos.Z;
     FmodChannel c = (FmodChannel)channel;
     result = c.channel.set3DAttributes(ref pos2, ref vel2);
     ERRCHECK(result);
 }
Пример #5
0
 public bool IsPlaying(Channel channel)
 {
     FMOD.RESULT result;
     bool b = false;
     result = ((FmodChannel)channel).channel.isPlaying(ref b);
     //ERRCHECK(result);
     return b;
 }
Пример #6
0
 public void Stop(Channel channel)
 {
 }
Пример #7
0
 public void SetPosition(Channel channel, Vector3 pos)
 {
 }
Пример #8
0
 public bool IsPlaying(Channel channel)
 {
     return true;
 }