Example #1
0
 public override int getCountDownValue()
 {
     if (GameEventManager.clockTime <= startTime && GameEventManager.clockTime >= startTime - countDownPeriod && isTimeBased)
     {
         ShredManager.createWarningShell();
         return(Mathf.RoundToInt(startTime - GameEventManager.clockTime));
     }
     else
     {
         return(-1);
     }
 }
Example #2
0
    void Update()
    {
        if (PlayerUI.isPaused)
        {
            actions.move(Vector3.zero);
            actions.rotate(Vector3.zero, 0);
            return;
        }

        // Movement
        var xMov     = Input.GetAxis("Horizontal") * transform.right;
        var yMov     = Input.GetAxis("Vertical") * transform.forward;
        var velocity = (xMov + yMov).normalized * speed;

        if (transform.name.Contains("unner") && !animator.GetBool("isReloading") && !animator.GetBool("isShooting"))
        {
            actions.move(Input.GetKey(KeyCode.LeftShift) ? velocity * runMultiplier : velocity);
        }
        else
        {
            actions.move(Input.GetKey(KeyCode.LeftShift) ? velocity * 1 : velocity);
        }

        if (transform.name.Contains("agician"))
        {
            actions.move(Input.GetKey(KeyCode.LeftShift) ? velocity * runMultiplier : velocity);
        }

        // Rotation
        var   yRot = new Vector3(0, Input.GetAxis("Mouse X"), 0) * lookSens * Time.deltaTime;
        float xRot = Input.GetAxis("Mouse Y") * lookSens * Time.deltaTime;

        actions.rotate(yRot, xRot);

        if (Input.GetButtonDown("Jump"))
        {
            actions.jump(jumpForce);
        }

        if (Input.GetButtonDown("Use"))
        {
            actions.pickup();
        }

        //Animation
        MovementAnimation(velocity);

        // TODO this shouldn't be here
        if (ShredManager.isInWarningZone(transform.position))
        {
            new UIMessage("WARNING! You are in the shredding zone!", 1);
            DynamicLightingController.singleton.informInShredZone();
            //Debug.Log("player is in warning zone!");
        }

        // Movement Sounds:
        if (isMoving && !audioSource.isPlaying)
        {
            audioSource.volume = Random.Range(0.8f, 1);
            audioSource.pitch  = Random.Range(0.8f, 1.1f);
            audioSource.Play();
        }
    }
Example #3
0
 private void setUpShredManager()
 {
     shredManager = GetComponent <ShredManager>();
     shredManager.setProperties(this, isServer, voxels);
 }
Example #4
0
 private void Start()
 {
     singleton = this;
 }