Inheritance: MonoBehaviour
コード例 #1
0
        protected override void OnStart(string[] args)
        {
            //System.Diagnostics.Debugger.Break();
            LogManager.WriteLog(string.Format("Starting Service ({0:D}).", Process.GetCurrentProcess().Id), LogManager.enumLogLevel.Info);
            IsStopRequested = false;

            try
            {
                //Get the connection string.
                _strConnectionString = DBBuilder.GetConnectionString();
            }
            catch (Exception ex)
            {
                ExceptionManager.Publish(ex);
            }

            // Initialize application settings (App.config, setting table, etc...)
            this.InitSettings();

            //ENABLE DISABLE
            if (Convert.ToBoolean(ConfigManager.Read("MachineConfig")) == true)
            {
                _EnableDisable = new EnableDisable();
            }

            //TITO
            if (Convert.ToBoolean(ConfigManager.Read("TITO")) == true)
            {
                _TITO = new TITO();
            }

            //AFTEnableDisable
            if (Convert.ToBoolean(ConfigManager.Read("AFTEnableDisable")) == true)
            {
                _enableDisableAFT = new AFTEnableDisable();
            }

            //Employee Master card broadcast
            if (Convert.ToBoolean(ConfigManager.Read("EmployeecardBroadcast")) == true)
            {
                _empMastercard = new EmployeeMasterCard();
            }

            //Instant Periodic Interval
            if (Convert.ToBoolean(ConfigManager.Read("InstantPeriodic")) == true)
            {
                _instantPeriodicInterval = new InstantPeriodicIntervalHandler();
            }

            //Request/Response Wait Configuration
            NetworkServiceSettings.RequestWaitTime = Convert.ToInt32(ConfigManager.Read("RequestWaitMilliSeconds"));
            NetworkServiceSettings.DBHitWaitTime   = Convert.ToInt32(ConfigManager.Read("DBHitWaitMilliSeconds"));



            LogManager.WriteLog("Started Service Successfully.", LogManager.enumLogLevel.Info);
        }
コード例 #2
0
 public void Set_DHCP_State(EnableDisable state)
 {
     ExcecuteCommand($"net dhcp p={(int)EnableDisable.Enable}");
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        // Cache local variables
        Vector3 movementAcceleration = Vector3.zero;
        float   deltaTime            = Time.deltaTime;
        bool    moveAxisPressed      = PlayerInputManager.PlayerActions.moveAxis.IsPressed && CanWalk();

        // Update lateral movement if appropriate
        if (moveAxisPressed || ownerCharacterController.velocity.sqrMagnitude > 0.0f)
        {
            // Transform camera space input into world space
            // If movement is pressed use the pressed direction
            // Otherwise, use the current velocity
            Vector3 horizontalDirection;
            float   horizontalAccelerationScalar = 1.0f;
            if (moveAxisPressed)
            {
                Vector2 moveInput = new Vector2(PlayerInputManager.PlayerActions.moveAxis.X, PlayerInputManager.PlayerActions.moveAxis.Y);
                horizontalDirection          = ownerCamera.transform.TransformDirection(new Vector3(moveInput.x, 0.0f, moveInput.y));
                horizontalDirection.y        = 0.0f;
                horizontalAccelerationScalar = Mathf.Clamp(moveInput.magnitude, -1.0f, 1.0f);
            }
            else
            {
                horizontalDirection = new Vector3(ownerCharacterController.velocity.x, 0.0f, ownerCharacterController.velocity.z);
            }

            if (horizontalDirection != Vector3.zero)
            {
                // Normalize to get the final movement direction
                horizontalDirection.Normalize();

                // Get the acceleration based on the movement direction
                movementAcceleration = GetHorizontalAcceleration(horizontalDirection, horizontalAccelerationScalar, deltaTime);

                // Rotate towards the movement direction
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(horizontalDirection), movementTurningSpeed * deltaTime);
            }

            characterAnimator.SetBool(walkAnimKey, true);
        }
        else
        {
            characterAnimator.SetBool(walkAnimKey, false);
        }

        // Update jump state
        if (ownerCharacterController.isGrounded)
        {
            // Start when pressed
            if (PlayerInputManager.PlayerActions.jump.WasPressed && CanJump())
            {
                verticalSpeed      = jumpAcceleration;
                fatJumping         = true;
                jumpStartTimeStamp = Time.time;
                characterAnimator.SetBool(jumpAnimKey, true);
            }
            // Stop when on the ground
            else
            {
                verticalSpeed = -gravity;
                fatJumping    = false;
                characterAnimator.SetBool(jumpAnimKey, false);
            }
        }

        // Update falling state
        else
        {
            // Update fat jumping
            if (fatJumping)
            {
                // End fat jump when jump released or we go beyond the maximum time
                if (!PlayerInputManager.PlayerActions.jump.IsPressed || Time.time - jumpStartTimeStamp > fatJumpTime)
                {
                    fatJumping     = false;
                    verticalSpeed -= gravity * Time.deltaTime;
                }

                // Otherwise, continue fat jumping
                // Do nothing in that case
            }

            // Handle gradual deceleration
            else
            {
                // Double deceleration at jump maximum
                verticalSpeed -= gravity * deltaTime * (verticalSpeed < 0.0f ? 2.0f : 1.0f);
            }
        }

        // Combine and apply horizontal and vertical movement
        movementAcceleration.y = verticalSpeed * deltaTime;
        if (movementAcceleration != Vector3.zero)
        {
            ownerCharacterController.Move(movementAcceleration);
        }

        // Update the best interactable if appropriate
        if (overlappingInteractables.Count > 1)
        {
            // Find the interactable we are closest to
            BaseInteraction bestInteractable = null;
            float           smallestDistance = 9999.0f;
            foreach (Collider interactable in overlappingInteractables)
            {
                float distanceToInteractable = Vector3.Distance(ownerCharacterController.transform.position, interactable.transform.position);
                if (distanceToInteractable < smallestDistance)
                {
                    bestInteractable = interactable.gameObject.GetComponent <BaseInteraction>();
                    smallestDistance = distanceToInteractable;
                }
            }

            // Update our best interactable
            if (bestInteractable != selectedInteractable)
            {
                // Deselect old best
                if (selectedInteractable)
                {
                    selectedInteractable.OnDeselected();
                }

                // Select new best
                selectedInteractable = bestInteractable;
                if (selectedInteractable)
                {
                    selectedInteractable.OnSelected();
                }
            }
        }

        // Interact with selected interactable if appropriate
        if (PlayerInputManager.PlayerActions.interact.WasPressed && selectedInteractable && CanInteract())
        {
            selectedInteractable.TryInteract();
            for (int i = 0; i < overlappingInteractables.Count; i++)
            {
                if (selectedInteractable.gameObject.name == overlappingInteractables[i].gameObject.name)
                {
                    EnableDisable overlap = overlappingInteractables[i].GetComponent <EnableDisable>();
                    for (int x = 0; x < overlap.toDisable.Length; x++)
                    {
                        if (overlap.toDisable[x].gameObject.name == selectedInteractable.gameObject.name)
                        {
                            overlappingInteractables.RemoveAt(i);
                        }
                    }
                }
            }
        }
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     enableDisable = GameObject.FindGameObjectWithTag("Player").GetComponent <EnableDisable>();
 }
コード例 #5
0
 public string EnableOrDisable(EnableDisable state)
 {
     return(ExecuteCommand(AMCC_3Ware_State.TW_CLI_path, TW_CLI_ParameterType.BBUEnableOrDisable, CtlID, state.ToString().ToLower()));
 }