コード例 #1
0
        public ObjectManager(Game game)
            : base(game)
        {
            random        = new Random((int)System.DateTime.Now.Ticks);
            tunnelManager = Costam.TunnelManager;

            //Obstacles = new List<MovableObject>();
            Obstacles          = new Dictionary <RigidBody, MovableObject>();
            Sequences          = new SortedList <float, Sequence>();
            NonSortedSequences = new List <FastSequence>();

            ToDispose = new List <MovableObject>();

            respawnPoint = new CollectiblePoint();
            respawnPoint.TunnelPosition         = Costam.TunnelManager.tp.PathPoints[startingPointRespawnTunnelPathIndex];
            respawnPointSentinel                = new CollectiblePoint();
            respawnPointSentinel.TunnelPosition = Costam.TunnelManager.tp.PathPoints[startingPointRespawnTunnelPathIndex];
            respawnPointSentinel.Move(respawnPointSentinellDistance);

            VirusRadius            = CalculateRadius(Costam.TUNNEL_RADIUS, Costam.VIRUS_SIZE);
            CollectiblePointRadius = CalculateRadius(Costam.TUNNEL_RADIUS, Costam.COLLECTIBLE_POINT_SIZE);
            RedBloodCellRadius     = CalculateRadius(Costam.TUNNEL_RADIUS, Costam.RED_BLOOD_CELL_SIZE);
            DiamondRadius          = CalculateRadius(Costam.TUNNEL_RADIUS, Costam.DIAMOND_SIZE);

            //InitBloodSequences(); InitDiamondSequences(); InitVirusesSequences();
            //InitDiamondSequences();
            //newSequenceIndex = random.Next(0, NonSortedSequences.Count); // TODO : zmieniæ kod przy zmianie na dictionary
            //newSequence = NonSortedSequences[newSequenceIndex];

            #region Blood Stream
            BloodStreamGenerator = new ObstaclesGenerator <RedBloodCell>();
            BloodStreamGenerator.TrackedObject           = Costam.PlayerManager.players.Values.ElementAt(0);
            BloodStreamGenerator.Density                 = bloodCellDensity;
            BloodStreamGenerator.DistanceToTrackedObject = 1000;
            BloodStreamGenerator.PartLength              = bloodCellStreamSize;
            BloodStreamGenerator.MinRadius               = 0.1f;
            BloodStreamGenerator.MaxRadius               = Costam.TUNNEL_RADIUS / 3;
            BloodStreamGenerator.MinAngle                = 0;
            BloodStreamGenerator.MaxAngle                = MathHelper.TwoPi;
            BloodStreamGenerator.ObjectBehaviours.Add(new BloodStream());

            BloodStreamGenerator.Enabled = true;
            #endregion BloodStream

            #region Viruses
            VirusGenerator = new ObstaclesGenerator <Virus>()
            {
                TrackedObject           = Costam.PlayerManager.players.Values.ElementAt(0),
                Density                 = virusDensity,
                DistanceToTrackedObject = 1500,
                PartLength              = VirusStreamSize,
                MinRadius               = PlayerManager.SmallRadius,
                MaxRadius               = VirusRadius,
                MinAngle                = 0,
                MaxAngle                = MathHelper.TwoPi,
            };
            VirusGenerator.Enabled = true;

            #endregion Viruses
        }
コード例 #2
0
        public void ReceiveMessageFromServiceBinding(IServiceBinding sender, KeyValuePair <string, int> remoteBinding, byte[] data)
        {
            var tunnelToUse = TunnelManager.GetTunnelByRemoteBinding(remoteBinding);

            if (tunnelToUse == null)
            {
                sender.ServiceDispatchFail(1, string.Format("An active tunnel does not exist for remote client {0}:{1}", remoteBinding.Key, remoteBinding.Value));
            }
            else
            {
                tunnelToUse.EnqueueMessage(new Message(data, new Random(PwUtils.SecondsSinceEpoch()).NextLong(Int64.MaxValue)));
            }
        }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        tunnelManager = TunnelManager.instance;

        anim = GetComponent <Animator>();

        //stamina = GetComponent<PlayerStamina>();
        playerStamina = GetComponent <PlayerStamina_2>();

        //boxCol2D = GetComponent<BoxCollider2D>();
        sprRender = GetComponent <SpriteRenderer>();

        isDigging = false;
    }
コード例 #4
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        tunnel             = _tunnel;
        tunnelCirclePrefab = _tunnelCirclePrefab;
        tunnelSquarePrefab = _tunnelSquarePrefab;
        tunnelBackTracking = _StepBackOnTunnelHit;
        tunnelWidth        = _tunnelWidth;
    }
コード例 #5
0
    void Awake()
    {
        gameManager   = GameObject.Find("Managers").GetComponent <GameManager>();
        inputDropdown = GameObject.Find("InputTypeDropdown").GetComponent <Dropdown>();
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(this);
        }

        tunnel             = _tunnel;
        tunnelCirclePrefab = _tunnelCirclePrefab;
        tunnelSquarePrefab = _tunnelSquarePrefab;
        tunnelBackTracking = _StepBackOnTunnelHit;
        tunnelWidth        = _tunnelWidth;
    }
コード例 #6
0
        public void ReceiveTunnelCreationRequestFromServiceBinding(IServiceBinding sender, string friendlyName, KeyValuePair <string, int> remoteBinding)
        {
            var tunnel = TunnelManager.GetTunnelByRemoteBinding(remoteBinding);

            if (tunnel == null)
            {
                try
                {
                    var t = TunnelManager.CreateTunnel(friendlyName, remoteBinding);
                    sender.TunnelCreationSucceed(t);
                }
                catch (Exception ex)
                {
                    Logger.ErrorFormat("Failed to create tunnel. Error was: {0}", ex.Message);
                    sender.TunnelCreationFail(2, ex.Message);
                }
            }
            else
            {
                var message = string.Format("Tunnel with remote binding {0}:{1} already exists.", remoteBinding.Key, remoteBinding.Value);
                Logger.Error(message);
                sender.TunnelCreationFail(2, message);
            }
        }
コード例 #7
0
        public MainService(bool daemon)
        {
            var settings = Properties.Settings.Default;

            if (settings.UpgradeRequired)
            {
                settings.Upgrade();
                settings.UpgradeRequired = false;
                settings.Save();
            }
            Natfrp.Token       = settings.Token; // Prevent possible token lost
            Natfrp.BypassProxy = settings.BypassProxy;

            AutoLogin = Natfrp.Token != null && Natfrp.Token.Length > 0;

            Daemonize = daemon;
            if (!daemon)
            {
                TickThread = new Thread(new ThreadStart(TickRun));
            }

            InitializeComponent();

            Pipe = new PipeServer(Utils.InstallationPipeName);
            Pipe.DataReceived += Pipe_DataReceived;

            LogManager    = new LogManager(this, 8192);
            NodeManager   = new NodeManager(this);
            TunnelManager = new TunnelManager(this);
            UpdateManager = new UpdateManager(this);
            RemoteManager = new RemoteManager(this)
            {
                Enabled    = settings.EnableRemote && settings.RemoteKey != null && settings.RemoteKey.Length > 0,
                EncryptKey = settings.RemoteKey
            };
        }
コード例 #8
0
ファイル: SectionTigger.cs プロジェクト: jomyhuang/TunnelGame
 // Use this for initialization
 void Start()
 {
     tunnelManager = TunnelManager.Instance;
 }
コード例 #9
0
 public Tunnel(TunnelManager manager)
 {
     Manager = manager;
 }
コード例 #10
0
 // Start is called before the first frame update
 void Awake()
 {
     SharedComponent = this;
     tunnelCounter   = new Dictionary <string, int>();
 }
コード例 #11
0
ファイル: TunnelManager.cs プロジェクト: jomyhuang/TunnelGame
 void Awake()
 {
     instance = this;
 }
コード例 #12
0
 void Start()
 {
     tunnelManager = TunnelManager.instance;
 }
コード例 #13
0
 void Awake()
 {
     instance = this;
 }
コード例 #14
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
            {
                content = new ContentManager(ScreenManager.Game.Services, "Content");
            }

            gameFont = content.Load <SpriteFont>("gamefont");

            // A real game would probably have more content than this sample, so
            // it would take longer to load. We simulate that by delaying for a
            // while, giving you a chance to admire the beautiful loading screen.

            #region Locals
            spriteBatch  = new SpriteBatch(ScreenManager.GraphicsDevice);
            otherTexture = ScreenManager.Game.Content.Load <Texture2D>("vein256");
            #endregion Locals

            #region Camera Manager

            cameraManager        = new CameraManager(ScreenManager.Game);
            Costam.CameraManager = cameraManager;

            DebugCamera camera = new Core.DebugCamera(ScreenManager.Game, new Vector3(-15, 0, 0),
                                                      Vector3.Zero, Vector3.Up);

            ChaseCamera chaseCamera = new ChaseCamera(ScreenManager.Game);

            cameraManager.AddCamera("DebugCamera", camera);
            cameraManager.AddCamera("ChaseCamera", chaseCamera);

            #endregion CameraManager

            #region Triggers
            triggerManager        = new TriggerManager(ScreenManager.Game);
            Costam.TriggerManager = triggerManager;

            #endregion Triggers

            #region Tunnel Manager
            tunnelManager        = new TunnelManager(ScreenManager.Game);
            Costam.TunnelManager = tunnelManager;
            #endregion TunnelManager

            #region Memory Managment
            objectsProvider = new SimpleMemoryPool();
            Costam.MemoryPoolObjectProvider = objectsProvider;
            #endregion Memory Managment

            #region Player

            playerManager        = new PlayerManager(ScreenManager.Game);
            Costam.PlayerManager = playerManager;

            chaseCamera.ChasedObject = Costam.PlayerManager.players.ElementAt(0).Value;


            #endregion PLayer

            #region HUD

            hud        = new Hud(ScreenManager.Game, spriteBatch);
            Costam.HUD = hud;
            //ScreenManager.Game.Components.Add(hud);

            SpriteFont consoleFont = ScreenManager.Game.Content.Load <SpriteFont>("HudFont");
            DebugTextWindow = new DebugConsole(new Rectangle(10, 10, 100, 50), consoleFont);
            hud.AddComponent(DebugDrawWindowName, DebugTextWindow);

            Vector2 windowDimensions = new Vector2(ScreenManager.Game.GraphicsDevice.Viewport.Width, ScreenManager.Game.GraphicsDevice.Viewport.Height);

            FPSCounter fpsCounter = new FPSCounter(new Rectangle((int)windowDimensions.X - 60, 5, 30, 20), consoleFont);
            hud.AddComponent("FPS", fpsCounter);

            if (playerManager.players.Count < 2)
            {
                PlayerHUD player1HUD = new PlayerHUD(new Rectangle((int)windowDimensions.X / 2, 0, 30, 20), consoleFont, playerManager.players.ElementAt(0).Value);
                hud.AddComponent("player1HUD", player1HUD);
            }
            else
            {
                PlayerHUD player1HUD = new PlayerHUD(new Rectangle(((int)windowDimensions.X / 2) - 70, 0, 30, 20), consoleFont, playerManager.players.ElementAt(0).Value);
                hud.AddComponent("player1HUD", player1HUD);


                PlayerHUD player2HUD = new PlayerHUD(new Rectangle((int)windowDimensions.X / 2, 0, 30, 20), consoleFont, playerManager.players.ElementAt(1).Value);
                hud.AddComponent("player2HUD", player2HUD);
            }



            #endregion HUD

            #region Object Manager
            objectManager        = new ObjectManager(Costam.Game);
            Costam.ObjectManager = objectManager;
            #endregion Object Manager

            #region Colision Manager
            collisionManager       = new CollisionManager(Costam.Game);
            Costam.ColisionManager = collisionManager;
            #endregion Colision Manager

            #region Debug
            debugDraw        = new DebugDraw();
            Costam.DebugDraw = debugDraw;

            Costam.Random = new Random((int)System.DateTime.Now.Ticks);
            #endregion Debug

            AfterLoadContent();


            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            ScreenManager.Game.ResetElapsedTime();
        }
コード例 #15
0
 private void Awake()
 {
     tunnelManager = FindObjectOfType <TunnelManager>();
 }
コード例 #16
0
    // Use this for initialization
    //IEnumerator Start () {
    void Start()
    {
        _tunnelManager = TunnelManager.Instance;

        transform.Rotate( new Vector3( 45, 0, 0 ) );

        //rigidbody.isKinematic = true;
        //yield return new WaitForSeconds(2);
        //rigidbody.isKinematic = false;
    }
コード例 #17
0
 private void Awake()
 {
     instance = this;
 }