Inheritance: MonoBehaviour
Example #1
0
        private void Update()
        {
            if (!player.HasTrait(PlayerTraits.Traits.CanBoost))
            {
                return;
            }

            if (!isRecharging)
            {
                isRecharging = state == States.None && player.CheckState(StateLabels.IsGrounded);
            }

            if (isRecharging && boostAvailable < MaxBoost)
            {
                boostAvailable += RechargeRate * Time.deltaTime;
            }

            if (state == States.Boosting)
            {
                boostAvailable -= BoostUsageRate * Time.deltaTime;
                if (boostAvailable <= 0)
                {
                    StopBoost();
                }
            }

            Mathf.Clamp(boostAvailable, 0, MaxBoost);
            DebugUI.SetBoostIndicatorFill(boostAvailable / MaxBoost);
        }
Example #2
0
    /// <summary>
    /// Start関数
    /// </summary>
    void Start()
    {
        // Debugger登録
        DebugUI.SetCounter(animationInfo, characterNum);
        // animation の情報初期化
        animationInfo.Initialize();
        // それぞれのバッファーを初期化/作成
        boardRenderers      = new BoardRenderer[characterNum];
        characterTransforms = new Transform[characterNum];

        var material = new Material(drawMaterial);

        material.mainTexture = animationInfo.texture;
        for (int i = 0; i < characterNum; ++i)
        {
            var gmo = GameObject.Instantiate(prefab, new Vector3(Random.RandomRange(-InitPosXParam, InitPosXParam), 0.5f, Random.RandomRange(-InitPosZParam, InitPosZParam)), Quaternion.identity);
            // 今回のサンプルではColliderは不要なので削除
            GameObject.Destroy(gmo.GetComponent <Collider>());
            characterTransforms[i] = gmo.transform;
            boardRenderers[i]      = gmo.GetComponent <BoardRenderer>();
            boardRenderers[i].SetMaterial(material);
            int idx = i % animationInfo.sprites.Length;
            boardRenderers[i].SetRect(animationInfo.GetUvRect(0));
        }
    }
Example #3
0
        public static bool OnProcessCmd(DebugUI.Command cmd)
        {
            DebugUI debugUI = MainGame.DebugUI;

            string main = cmd.main;

            if (main.ToLower() [0] == 'c' && main.ToLower() [1] == ':')
            {
                if (((int)xc.Game.GetInstance().GameMode & (int)xc.Game.EGameMode.GM_Net) == (int)xc.Game.EGameMode.GM_Net)
                {
                    SendGMCommandForDebugUI(cmd);
                }
                else
                {
                    debugUI.PushLog("非联网模式无法发送聊天");
                    debugUI.PushLog(main.ToLower());
                }
                return(true);
            }

            if (main.ToLower()[0] == 'x' && main.ToLower()[1] == ':')
            {
                if (((int)xc.Game.GetInstance().GameMode & (int)xc.Game.EGameMode.GM_Net) == (int)xc.Game.EGameMode.GM_Net)
                {
                    SendGMCommandThroughMajorConnect(cmd);
                }
            }


            return(ToProcessCommand(main, cmd.paramArray, debugUI));
        }
Example #4
0
    public void EnqueueInput(NetCommand.PlayerInputCommand command, Player player, uint serverWorldTick)
    {
        // Monitoring.
        DebugUI.ShowValue("sv stale inputs", staleInputs);

        // Calculate the last tick in the incoming command.
        uint maxTick = command.StartWorldTick + (uint)command.Inputs.Length - 1;

        // Scan for inputs which haven't been handled yet.
        if (maxTick >= serverWorldTick)
        {
            uint start = serverWorldTick > command.StartWorldTick
          ? serverWorldTick - command.StartWorldTick : 0;
            for (int i = (int)start; i < command.Inputs.Length; ++i)
            {
                // Apply inputs to the associated player controller and simulate the world.
                var worldTick = command.StartWorldTick + i;
                var tickInput = new TickInput {
                    WorldTick      = (uint)worldTick,
                    RemoteViewTick = (uint)(worldTick - command.ClientWorldTickDeltas[i]),
                    Player         = player,
                    Inputs         = command.Inputs[i],
                };
                queue.Enqueue(tickInput, worldTick);

                // Store the latest input in case the simulation needs to repeat missed frames.
                latestPlayerInput[player.Id] = tickInput;
            }
        }
        else
        {
            staleInputs++;
        }
    }
Example #5
0
        /// <summary>
        /// 隐藏调试UI
        /// </summary>
        public static void HideDebugUI()
        {
            DebugUI debugUI = DebugUI;

            if (debugUI != null)
            {
                debugUI.enabled = false;
            }

            var fps_respond = mCoreObject.GetComponent <FPSRespond>();

            if (fps_respond != null)
            {
                fps_respond.enabled = false;
            }

            DebugFPS debugFPS = mCoreObject.GetComponent <DebugFPS>();

            if (debugFPS != null)
            {
                debugFPS.enabled = false;
            }

            if (debugWindow != null)
            {
                debugWindow.gameObject.SetActive(false);
            }
        }
Example #6
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //mode =! mode;
        }
        if (Input.GetMouseButtonDown(0))
        {
            // Entityセット用のデータ作成
            MyTransform trans = new MyTransform();
            CharaData   chara = new CharaData();

            for (int i = 0; i < clickInstance; ++i)
            {
                // Entityの作成
                var entity = manager.CreateEntity(charaArch);
                //座標セット
                float x = -InitPosXParam + i * 2 * InitPosXParam / clickInstance;
                trans.position = new Vector3(x, 0.5f, -InitPosZParam);
                // キャラクターのデータセット
                chara.time     = Random.Range(0.0f, 3.0f); // 少し揺れ幅を持たせます
                chara.velocity = new Vector3(0.0f, 0.0f, 3.0f);
                // 生成したEntitiyにデータセット
                manager.SetComponentData(entity, trans);
                manager.SetComponentData(entity, chara);
            }
        }
        // デバッグ情報更新
        DebugUI.SetCharaNum(charaSystem.CharaNum);
        charaSystem.Update();
    }
Example #7
0
    /// <summary>
    /// Start関数
    /// </summary>
    void Start()
    {
        // Debugger登録
        DebugUI.SetCounter(animationInfo, characterNum);
        // animation の情報初期化
        animationInfo.Initialize();
        // それぞれのバッファーを初期化/作成
        boardRenderers      = new BoardRenderer[characterNum];
        characterTransforms = new Transform[characterNum];
        velocities          = new NativeArray <Vector3>(characterNum, Allocator.Persistent);
        drawParameter       = new NativeArray <Rect>(characterNum, Allocator.Persistent);
        animationRectInfo   = new NativeArray <Rect>(animationInfo.Length, Allocator.Persistent);
        for (int i = 0; i < animationInfo.Length; ++i)
        {
            animationRectInfo[i] = animationInfo.GetUvRect(i);
        }
        var material = new Material(drawMaterial);

        material.mainTexture = animationInfo.texture;
        for (int i = 0; i < characterNum; ++i)
        {
            var gmo = GameObject.Instantiate(prefab, new Vector3(Random.RandomRange(-InitPosXParam, InitPosXParam), 0.5f, Random.RandomRange(-InitPosZParam, InitPosZParam)), Quaternion.identity);
            characterTransforms[i] = gmo.transform;
            boardRenderers[i]      = gmo.GetComponent <BoardRenderer>();
            boardRenderers[i].SetMaterial(material);
            int idx = i % animationInfo.sprites.Length;
            boardRenderers[i].SetRect(animationInfo.GetUvRect(idx));
        }
        for (int i = 0; i < characterNum; ++i)
        {
            velocities[i] = new Vector3(Random.RandomRange(-1.0f, 1.0f), 0.0f, Random.RandomRange(-1.0f, 1.0f));
            velocities[i] = velocities[i].normalized;
        }
    }
Example #8
0
        public override void Load()
        {
            base.Load();

            instance = this;

            if (!Main.dedServ)
            {
                debugInterface = new UserInterface();

                debugUI = new DebugUI();
                debugUI.Activate();
            }

            if (Main.netMode != NetmodeID.Server)
            {
                Ref <Effect> filterRef = new Ref <Effect>(GetEffect("Effects/GlyphBurningGlow"));
                Filters.Scene["GlyphBurningGlow"] = new Filter(new ScreenShaderData(filterRef, "GlyphBurningGlow"), EffectPriority.VeryHigh);
                Filters.Scene["GlyphBurningGlow"].Load();

                Ref <Effect> filterRef2 = new Ref <Effect>(GetEffect("Effects/GlyphBurningDistort"));
                Filters.Scene["GlyphBurningDistort"] = new Filter(new ScreenShaderData(filterRef2, "GlyphBurningDistort"), EffectPriority.VeryHigh);
                Filters.Scene["GlyphBurningDistort"].Load();
            }
        }
Example #9
0
 void Start()
 {
     _debugUI     = GameObject.Find("DebugUI").GetComponent <DebugUI>();
     _text        = gameObject.GetComponent <Text>();
     _canvasGroup = gameObject.GetComponent <CanvasGroup> ();
     _baseAlpha   = 1f;
 }
Example #10
0
 void Start()
 {
     _debugUI = GameObject.Find("DebugUI").GetComponent<DebugUI>();
     _text = gameObject.GetComponent<Text>();
     _canvasGroup = gameObject.GetComponent<CanvasGroup> ();
     _baseAlpha = 1f;
 }
        protected override void OnFrameRun(float deltaTime, float realDeltaTime)
        {
            DebugUI.SetDebugLabel("Spawner pos", transform.position);
            FadeIn.RunFrame(deltaTime);
            DeactivateTimer.Increment(deltaTime);

            CreateFleetingTextAtCenter("SPAWNER");
        }
Example #12
0
        private void Start()
        {
            player  = Player.Instance;
            gravity = player.GetComponent <PlayerGravity>();
            body    = player.GetComponent <Rigidbody2D>();

            DebugUI.SetBoostIndicatorFill(boostAvailable / MaxBoost);
        }
Example #13
0
            static void Postfix(DebugUI __instance)
            {
                Timer gifTimer = typeof(DebugUI).GetFieldValue <Timer>("manualGifTimer");

                gifTimer.Enabled = true;
                __instance.gameObject.SetActive(true);
                Mod.helper.Log("test");
            }
Example #14
0
    private void Awake()
    {
        instance = this;
        //this.gameObject.SetActive(!Overseer.Instance.DebugEnabled);


        debugTextElement.text = "";
    }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         DebugUI.SetText("Trait Unlocked:\n" + TraitUnlock.ToString());
         Player.Instance.AddTrait(TraitUnlock);
         Destroy(gameObject);
     }
 }
Example #16
0
 void Awake()
 {
     if (_instance != null)
     {
         Debug.Log("Instance already exists!");
         return;
     }
     _instance = this;
 }
Example #17
0
 private void UpdateAccumulatedStats()
 {
     sendAverage.Update(Time.deltaTime, netManager.Statistics.BytesSent - lastBytesSent);
     recvAverage.Update(Time.deltaTime, netManager.Statistics.BytesReceived - lastBytesRecv);
     DebugUI.ShowValue("send bps", sendAverage.Average);
     DebugUI.ShowValue("recv bps", recvAverage.Average);
     lastBytesSent = netManager.Statistics.BytesSent;
     lastBytesRecv = netManager.Statistics.BytesReceived;
 }
Example #18
0
    public static void SetDebugShow(bool bShow)
    {
        DebugUI debugUI = Main.instance.GetComponent <DebugUI>();

        if (debugUI == null)
        {
            return;
        }
        debugUI.IsDrawDebug = bShow;
    }
        private void Init()
        {
            DebugUI = FindObjectOfType <Canvas>().GetComponent <DebugUI>();

            SkeletonAnimation = GetComponent <SkeletonAnimation>();
            AnimationState    = SkeletonAnimation.AnimationState;
            Body       = GetComponent <Rigidbody2D>();
            FireBreath = GetComponentInChildren <FireBreathController>();

            SetAnim(AnimTrack.Movement, Anim.IDLE_NORMAL, true);
        }
 DebugUI()
 {
     if (instance)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
     }
 }
Example #21
0
 public static void Show()
 {
     if (Instance != null)
     {
         Instance.gameObject.SetActive(true);
     }
     else
     {
         Instance = UISystem.InstantiateUI("DebugUI").GetComponent <DebugUI>();
     }
 }
Example #22
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
 private void Awake( )
 {
     if (instance != null)
     {
         throw new Exception("Debug UI already exists");
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(instance);
     }
 }
Example #24
0
	// Use this for initialization
	void Start () {
        timeleft = updateInterval;  
        
        sceneFader = GameObject.FindGameObjectWithTag("GameController").GetComponent<SceneFader>();
        healthController = GameObject.FindGameObjectWithTag("Player").GetComponent<HealthController>();

        ui_timerText = GameObject.Find("UI_Canvas/UI_TimerText").GetComponent<TimerUI>();
        ui_levelInfo = GameObject.Find("UI_Canvas/UI_LevelInfoText").GetComponent<LevelInfoUI>();
        
        ui_healthPoints = GameObject.Find("UI_Canvas/UI_HealthPoints").GetComponent<HealthPointsUI>();
        ui_debug = GameObject.Find("UI_Canvas/UI_Debug").GetComponent<DebugUI>();
	}
 protected override void PostUpdate()
 {
     // Process the remaining world states if there are any, though we expect this to be empty?
     // TODO: This is going to need to be structured pretty differently with other players.
     excessWorldStateAvg.Push(worldStateQueue.Count);
     //while (worldStateQueue.Count > 0) {
     //  ProcessServerWorldState();
     //}
     // Show some debug monitoring values.
     DebugUI.ShowValue("cl rewinds", replayedStates);
     DebugUI.ShowValue("incoming state excess", excessWorldStateAvg.Average());
     clientSimulationAdjuster.Monitoring();
 }
Example #26
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(this.gameObject);
    }
Example #27
0
    public void LogQueueStatsForPlayer(Player player, uint worldTick)
    {
        int count = 0;

        foreach (var entry in queue)
        {
            if (entry.Player.Id == player.Id && entry.WorldTick >= worldTick)
            {
                count++;
                worldTick++;
            }
        }
        averageInputQueueSize.Push(count);
        DebugUI.ShowValue("sv avg input queue", averageInputQueueSize.Average());
    }
Example #28
0
        public void Tick(float deltaTime)
        {
            bool hitGround = GroundHitCheck();

            if (hitGround && state == States.NotGrounded)
            {
                state = States.Grounded;
            }
            else if (!hitGround && state == States.Grounded)
            {
                timeLeftGround = Time.time;
                state          = States.NotGrounded;
            }

            DebugUI.SetText(state.ToString());
        }
Example #29
0
    // Use this for initialization
    void Start()
    {
        m_updateIn = updateDelta;
        m_snake    = new Snake(m_body);
        m_camera   = camera.GetComponent <Camera>();

        // set the debug component
        debugUI = GameObject.Find("_GM").GetComponent <DebugUI>();

        m_snake.addHead(m_head, new Vector2(0, 0));

        // Add 3 body parts
        for (int i = 0; i < numberOfParts; i++)
        {
            m_snake.addBody(m_body, new Vector2(0, (i + 1) * -0.64f));
        }
    }
Example #30
0
    void Awake()
    {
        if (_instance != null)
        {
            Debug.LogWarning("You can only have one instance of DebugUI! Ignoring additional...");
        }
        else
        {
            _instance = this;
        }

        _uiText = gameObject.GetComponent <Text>();
        if (_uiText == null)
        {
            Debug.LogWarning("You need to have a Text component!");
        }
    }
Example #31
0
        // Use this for initialization
        IEnumerator Start()
        {
            yield return(null);

            /*
             * // Open/close console.
             * if (CrossPlatformInputManager.GetButtonDown(InputMapping.GetInputString(InputMapping.Key.ToggleConsole)))
             * {
             *  bool activate = !DebugUI.ConsoleActive;
             *
             *  DebugUI.ActivateConsole(activate);
             * }
             */

            DebugUI.SetCurrentGameCamera(Camera.main);
            DebugUI.EnableFlyCamera(true);
            Cursor.lockState = CursorLockMode.Locked;
        }
Example #32
0
 public void UpdatePlayerImage(Player currentPlayer)
 {
     if (currentPlayer.Type == PlayerType.Battlebeard)
     {
         //Change to player images once in
         BBImage.enabled = true;
         SSImage.enabled = false;
     }
     else if (currentPlayer.Type == PlayerType.Stormshaper)
     {
         BBImage.enabled = false;
         SSImage.enabled = true;
     }
     else
     {
         DebugUI.getUI().SetMessage("An Error has occurured in resourceUI; playerType cannot be none", 22, Color.red);
     }
 }
Example #33
0
    protected void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);

        if (Debug.isDebugBuild || Application.isEditor)
        {
            Show();
        }
        else
        {
            Hide();
        }
    }
Example #34
0
 void Awake()
 {
     ui = this;
 }