setValue() 공개 정적인 메소드

public static setValue ( string key, System value ) : void
key string
value System
리턴 void
예제 #1
0
 public override void SceneLoadLocalBegin(string map)
 {
     GameManager.instance.ChangeGameState(GameManager.GameState.PRE_GAME);
     DebugHUD.setValue("load state", "Loading scene");
     FindObjectOfType <LobbyState>().HideDebugDraw = true;
     //display loading screen
 }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (!tempSelectedUnit)
        {
            tempSelectedUnit = selector.SelectedUnit;
        }
        DebugHUD.setValue("Is dismissed", infoPanel.dismissButton.Dismissed);
        if (match)
        {
            updateGameInfo();
//			if (selector.SelectedUnit) {
//				if (!selector.SelectedUnit.Equals(selectedUnit) || infoPanel.dismissButton.Dismissed) {
            //selectedUnit = selector.SelectedUnit;
            infoPanel.updateSelectedInfo(selectedUnit);
//					infoPanel.gameObject.SetActive(true);
//					infoPanel.dismissButton.Dismissed = false;
//					alreadyDismissed = false;
//				}
//			} else {
////				infoPanel.gameObject.SetActive(false);
//				if (!alreadyDismissed) {
//					infoPanel.dismissButton.Dismissed = true;
//					alreadyDismissed = true;
//				}
//			}
            EndTurn.SetActive(match.MyTurn);
        }
        else
        {
            match = MatchManager.instance;
            displayJumpButtons();
        }
    }
예제 #3
0
    void Update()
    {
        timeleft -= Time.deltaTime;
        accum    += Time.timeScale / Time.deltaTime;
        ++frames;

        // Interval ended - update GUI text and start new interval
        if (timeleft <= 0.0)
        {
            // display two fractional digits (f2 format)
            fps = accum / frames;
            string format = System.String.Format("{0:F2}", fps);
            string color;

            if (fps < 30)
            {
                color = "yellow";
            }
            else
            if (fps < 10)
            {
                color = "red";
            }
            else
            {
                color = "green";
            }
            DebugHUD.setValue("FPS", "<color=" + color + ">" + format + "</color>");
            timeleft = updateInterval;
            accum    = 0.0F;
            frames   = 0;
        }
    }
예제 #4
0
파일: Gun.cs 프로젝트: hne3/GameProject
    public void Firing()
    {
        if (muzzleFlash != null)
        {
            //StartCoroutine(MuzzleFlash());
            muzzleFlash.Play();
        }
        DebugHUD.setValue("muzzle flash", muzzleFlash.isPlaying);

        timeUntilCooldownBegins = CooldownDelay;
        Temperature            += HeatPerShot;
        if (Temperature >= MaxTemperature)
        {
            IsOverheating       = true;
            Temperature         = MaxTemperature;
            player.LaserVisible = false;
        }
        else
        {
            if (RefreshRaycast())
            {
                IPlayer target = GetTarget();

                //Add in check for friendly fire here.
                if (target != null && target.Team != player.Team)
                {
                    target.TakeDamage(DamagePerShot, target.Username, -SourceTransform.forward, WeaponID);
                }
            }
            player.MuzzlePoint   = GunShotStartTransform.position;
            player.LaserEndpoint = endpoint;
            player.LaserVisible  = true;
        }
    }
예제 #5
0
 void Update()
 {
     DebugHUD.setValue("IsSever", BoltNetwork.isServer);
     if (BoltNetwork.isClient)
     {
         DebugHUD.setValue("ping", BoltNetwork.server.PingNetwork);
     }
     DebugHUD.setValue("username", GameManager.instance.CurrentUserName);
 }
예제 #6
0
파일: Gun.cs 프로젝트: hne3/GameProject
    void Update()
    {
        if (Physics.Raycast(SourceTransform.position, SourceTransform.forward, out hitInfo, float.PositiveInfinity, shootableLayers))
        {
            IPlayer hitplayer = hitInfo.transform.GetComponent <AbstractPlayer>();
            if (hitplayer != null)
            {
                if (!assisting)
                {
                    AimAssist(hitplayer);
                }
            }
            else
            {
                if (assisting)
                {
                    ResetAimAssist();
                }
            }
        }

        DebugHUD.setValue("Gun temp", Temperature);
        DebugHUD.setValue("Gun overheated", IsOverheating);
        if (timeUntilCooldownBegins > 0f)
        {
            timeUntilCooldownBegins = Mathf.Max(0f, timeUntilCooldownBegins - Time.deltaTime);
        }
        if (timeUntilCooldownBegins <= 0f && Temperature >= 0f)
        {
            Temperature -= CooldownRate * Time.deltaTime * (IsOverheating ? OverheatedCooldownMultiplier : 1.0f);
            if (Temperature <= 0f)
            {
                Temperature   = 0f;
                IsOverheating = false;
            }
        }
//        if (timeUntilNextShot > 0f) {
//            timeUntilNextShot = Mathf.Max(0f, timeUntilNextShot - Time.deltaTime);
//            return;
//        }
        if (IsOverheating)
        {
            player.LaserVisible = false;
            return;
        }
        if (Input.GetButton("Fire1"))
        {
            player.LaserVisible = true;
            Firing();
        }
        else
        {
            player.LaserVisible = false;
        }
    }
예제 #7
0
    //FixedUpdate called at a fixed framerate of 60
    //SimulateOwner is called from FixedUpdate, but only for the owner of the object
    public override void SimulateOwner()
    {
        float timeSinceThrown = StartingFuseTime - FuseTimeRemaining;

        DebugHUD.setValue("DetonateTime", DetonateTime);
        DebugHUD.setValue("ServerTime", BoltNetwork.serverTime);
        DebugHUD.setValue("FuseTimeRemaining", FuseTimeRemaining);

        //Self-destroy object after its fuse is done.
        if (FuseTimeRemaining <= 0f)
        {
            Detonate();
        }
    }
예제 #8
0
    /// <summary>
    /// update just contains some non-essential debug code
    /// </summary>
    void Update()
    {
        var t = GetTileAtMouse();

        DebugHUD.setValue("TileUnderMouse", t as Tile);
        if (t != null)
        {
            DebugHUD.setValue("UnitsInSightOfTile", "{" + string.Join(", ", t.UnitsInSight.ToArray()) + "}");
        }
        else
        {
            DebugHUD.setValue("UnitsInSightOfTile", "N/A");
        }
    }
예제 #9
0
    public override void SceneLoadLocalDone(string map)
    {
        //instantiate the player
        BoltEntity  entity = BoltNetwork.Instantiate(BoltPrefabs.PlayerPrefab);
        PlayerState ps     = entity.GetComponent <PlayerState>();

        ps.Name = GameManager.instance.CurrentUserName; //set their name
        ps.Team = GameManager.instance.Lobby.GetTeamLookup()[GameManager.instance.CurrentUserName];
        if (!BoltNetwork.isServer)
        {
            entity.AssignControl(BoltNetwork.server);  //this line is completely useless and should be removed
        }
        DebugHUD.setValue("load state", "Scene loaded, unsynced");
        //the scene has now been loaded for this player, but we have not synchronized the players yet
    }
예제 #10
0
    /// <summary>
    /// State updates.
    /// </summary>
    void Update()
    {
        if (this.dead)
        {
            return;
        }

        // TODO: fix this spelling mistake in the code whereever it originated.
        DebugHUD.setValue("IsServer", BoltNetwork.isServer);

        if (BoltNetwork.isClient)
        {
            //DebugHUD.setValue("ping", BoltNetwork.server.PingNetwork);
        }

        DebugHUD.setValue("username", GameManager.instance.CurrentUserName);
    }
예제 #11
0
    // Update is called once per frame
    void Update()
    {
        DebugHUD.setValue("laser endpoint", player.LaserEndpoint);
        line.enabled = player.LaserVisible;
        line.SetPosition(0, player.MuzzlePoint);
        line.SetPosition(1, player.LaserEndpoint);
//        curFadeTime += Time.deltaTime;
//        if(curFadeTime >= FadeTime){
//            Destroy(this.gameObject);
//            return;
//        }
//        float fadePercent = curFadeTime / FadeTime;
//        float adjustedFade = FadeCurve.Evaluate(fadePercent);
//
//        Color newColor = BeamColor;
//        newColor.a = adjustedFade;
//        line.SetColors(newColor, newColor);
    }
예제 #12
0
 //Sync Event handler (client and server)
 public override void OnEvent(SyncEvent evnt)
 {
     Debug.Log("Sync event recieved");
     StartTime = evnt.StartTime;
     if (evnt.StartTime < BoltNetwork.serverTime)
     {
         if (!BoltNetwork.isServer)
         {
             BoltNetwork.server.Disconnect(new DisconnectReason("Sync Failure", "Failed to synchronize with the server in time"));
         }
         else
         {
             Debug.LogWarning("Server recieved sync message that is before the current time?");
         }
     }
     DebugHUD.setValue("load state", "Synch message recieved");
     running = true;
     //hide loading screen
 }
예제 #13
0
 void Update()
 {
     if (!running)
     {
         return;
     }
     if (BoltNetwork.serverTime >= StartTime)
     {
         DebugHUD.setValue("load state", "Game started");
         //allow the player to move
         running = false;
         Destroy(this);
         GameManager.instance.ChangeGameState(GameManager.GameState.IN_GAME);
     }
     else
     {
         DebugHUD.setValue("load state", "Sync message recieved, game starts in " + (StartTime - BoltNetwork.serverTime));
     }
     DebugHUD.setValue("server time", BoltNetwork.serverTime);
     DebugHUD.setValue("start time", StartTime);
 }
예제 #14
0
    public void moveCharacter(Vector2 inputVector)
    {
        //Debouncing for cornering controls
        if (debounceTime < shiftDebounce)
        {
            debounceTime += Time.fixedDeltaTime;
        }
        if (firstLerp || secondLerp)
        {
            lerp();
            return;
        }
        //Vector2 inputVector = GetInput();
        DebugHUD.setValue("last normal", lastNormal);
        float   movementSpeed    = character.velocity.sqrMagnitude;
        float   desiredSpeed     = calcupateDesiredSpeed(inputVector);
        Vector3 worldSpaceVector = pCamera.transform.TransformDirection(inputVector.x, inputVector.y, 0);

        //Zero movement on axis if necessary
        //New velocity cancelling code.
        zeroMovement(inputVector);
        Vector3 moveFromLast = Vector3.ProjectOnPlane(worldSpaceVector, lastNormal);

        if (movementSpeed < maxVelocity * maxVelocity)
        {
            RaycastHit hit;
            //Ok so we agree this works, this is the on a surface without extreme angles
            if (Physics.SphereCast(character.position + (desiredSpeed * moveFromLast * Time.deltaTime), .1f, -lastNormal, out hit,
                                   grabDistance + character.GetComponent <SphereCollider>().radius, moveableLayers))
            {
                Vector3 moveVector = Vector3.ProjectOnPlane(worldSpaceVector, hit.normal);
                if (Vector3.Dot(hit.normal, lastNormal) >= Mathf.Cos(5 * Mathf.Deg2Rad))
                {
                    character.AddForce(moveVector * desiredSpeed * Time.fixedDeltaTime * accelerationFactor, ForceMode.Impulse);
                }
                else
                {
                    // Debug.Log("different normal from surface");
                    character.AddForce(-character.velocity + Quaternion.AngleAxis(Vector3.Angle(lastNormal, hit.normal),
                                                                                  Vector3.Cross(lastNormal, hit.normal)) * character.velocity, ForceMode.Impulse);
                    character.AddForce(moveVector * desiredSpeed * Time.fixedDeltaTime * accelerationFactor, ForceMode.Impulse);
                }
                if (Vector3.Dot(hit.normal, lastNormal) < Mathf.Cos(90 * Mathf.Deg2Rad))
                {
                    lastNormal = hit.normal;
                    lastPoint  = hit.point;
                }
            }

            //This would handle transitions between surfaces and not allowing the player to go over the edge
            else
            {
                // Debug.Log("Lost surface");

                //First handle not going off the edge, easy, just move in opposite of desired direction.
                Vector3 moveVector = Vector3.ProjectOnPlane(lastPoint - character.position, lastNormal);
                character.AddForce(-character.velocity + (.5f * moveVector), ForceMode.Impulse);

                //Now deal with rounding corners. We're going to try a press button to move around corner approach.
                //TODO: Use only the actual input system.
                //if (Input.GetKey(KeyCode.LeftShift) && debounceTime >= shiftDebounce)
                //{
                //    shiftDebounce = 0;
                //    roundCorner(inputVector, desiredSpeed);
                //}
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        string stateString = "";

        if (inputDisabled)
        {
            stateString += "Input Disabled";
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.M))
            {
                PanWhenMouseAtEdge = !PanWhenMouseAtEdge;
            }

            //DEBUG
            if (Input.GetKeyDown(KeyCode.Alpha0))
            {
                AnimateMove(Vector3.zero, 5f);
            }


            DebugHUD.setValue("Mouse X", Input.GetAxis("Mouse X"));
            DebugHUD.setValue("Mouse Y", Input.GetAxis("Mouse Y"));

            bool up         = Input.GetKey(KeyCode.UpArrow);
            bool down       = Input.GetKey(KeyCode.DownArrow);
            bool left       = Input.GetKey(KeyCode.LeftArrow);
            bool right      = Input.GetKey(KeyCode.RightArrow);
            bool shift      = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
            bool leftClick  = Input.GetMouseButton(2);
            bool rightClick = Input.GetMouseButton(1);

            float x = 0f;
            float y = 0f;
            if (shift)
            {
                if (up)
                {
                    y += 1;
                }
                if (down)
                {
                    y -= 1;
                }
                if (left)
                {
                    x -= 1;
                }
                if (right)
                {
                    x += 1;
                }
                stateString += "Keyboard Orbit, ";
            }
            if (leftClick && !shift)
            {
                x           += Input.GetAxis("Mouse X");
                y           -= Input.GetAxis("Mouse Y");
                stateString += "Mouse Orbit, ";
            }
            ShiftOribitAngles(x, y);

            DoScrollZoom();

            DebugHUD.setValue("OrbitX", x);
            DebugHUD.setValue("OrbitY", y);


            if (rightClick)
            {
                MoveAlongBoardNonNormalized(new Vector3(Input.GetAxis("Mouse X"), 0f, Input.GetAxis("Mouse Y")));
                stateString += "Mouse Pan, ";
            }


            if (PanWhenMouseAtEdge && !leftClick && !rightClick)
            {
                Vector3 mousePosition = Input.mousePosition;
                if (mousePosition.y > (Screen.height - MousePanBounds))
                {
                    up = true;
                }
                if (mousePosition.y < MousePanBounds)
                {
                    down = true;
                }
                if (mousePosition.x > (Screen.width - MousePanBounds))
                {
                    right = true;
                }
                if (mousePosition.x < MousePanBounds)
                {
                    left = true;
                }
                stateString += "Checking Edges, ";
            }


            if ((up || down || left || right) && !shift)
            {
                Vector3 movement = Vector3.zero;
                if (up)
                {
                    movement += Vector3.forward;
                }
                if (down)
                {
                    movement += Vector3.back;
                }
                if (left)
                {
                    movement += Vector3.left;
                }
                if (right)
                {
                    movement += Vector3.right;
                }
                MoveAlongBoardNormalized(movement);
                stateString += "Panning, ";
            }
        }
        DebugHUD.setValue("Camera States", stateString);
    }