Teleport() private méthode

private Teleport ( ) : void
Résultat void
Exemple #1
0
    private void Start()
    {
        Vector3 dest = _skipTutorial ? _gameStartPos : _tutorialStartPos;

        _teleporter.Teleport(dest);

        _audioSource.clip = _sounds.GameStart;
        _audioSource.Play();
    }
    IEnumerator ResetRace()
    {
        teleporter.Teleport();
        yield return(new WaitForSeconds(teleporter.fadeDuration));

        raceController.ResetRace();
    }
Exemple #3
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "GrabVolumeBig")
     {
         teleporter.Teleport();
     }
 }
Exemple #4
0
 public void Teleport(Vector3 point)
 {
     // if some condition was met only then do so (e.g has mana etc. or needs to move first to some position)
     // Or maybe after teleporting it will cause some damage.
     // But to actually deal with teleporting effect etc. we delegate this to Teleporter.
     teleporter.Teleport(point);
 }
Exemple #5
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetAxis("Fire2") > 0.1 && FirstCheck && GetComponent <CollisionChecks>().TouchingElementalInteractable_ == true)
     {
         var  inventory   = GetComponent <Inventory>();
         bool isGoodToAdd = true;
         for (int i = 0; i < inventory.list_.Count; ++i)
         {
             if (TempTypes.name_ == inventory.list_[i].name_)
             {
                 isGoodToAdd = false;
             }
         }
         if (isGoodToAdd)
         {
             inventory.list_.Add(TempTypes);
         }
         FirstCheck = false;
     }
     else if (Input.GetAxis("Fire2") > 0.1 && FirstCheck && GetComponent <CollisionChecks>().TouchingTeleporterInteractable_ == true)
     {
         TempPorter.Teleport();
         FirstCheck = false;
     }
     else if (Input.GetAxis("Fire2") < 0.1)
     {
         FirstCheck = true;
     }
 }
Exemple #6
0
        void FixedUpdate()
        {
            InputDevices.GetDevicesAtXRNode(role, devices);
            if (devices.Count > 0)
            {
                device = devices[0];
            }

            if (device != null && device.isValid)
            {
                //Sets hand fingers wrap
                if (device.TryGetFeatureValue(XRHandControllerLink.GetCommonButton(button), out bool teleportButton))
                {
                    if (teleporting && !teleportButton)
                    {
                        hand.Teleport();
                        teleporting = false;
                    }
                    else if (!teleporting && teleportButton)
                    {
                        hand.StartTeleport();
                        teleporting = true;
                    }
                }
            }
        }
Exemple #7
0
        public static bool Prefix(KillButtonManager __instance)
        {
            if (!PlayerControl.LocalPlayer.Is(RoleEnum.Teleporter))
            {
                return(true);
            }

            if (
                !PlayerControl.LocalPlayer.CanMove ||
                PlayerControl.LocalPlayer.Data.IsDead
                )
            {
                return(false);
            }

            Teleporter role = Role.GetRole <Teleporter>(PlayerControl.LocalPlayer);

            if (__instance != role.TeleportButton)
            {
                return(true);
            }

            if (
                __instance.isCoolingDown ||
                !__instance.isActiveAndEnabled ||
                role.CooldownTimer() > 0 ||
                Utils.IsSabotageActive()
                )
            {
                return(false);
            }

            role.Teleport();
            return(false);
        }
        private void CboxBossTeleport_SelectedIndexChanged(object sender, EventArgs e)
        {
            var boss = cboxBossTeleport.SelectedItem.ToString().Boss();

            if (boss == null)
            {
                return;
            }
            Teleporter.Teleport(boss);
        }
 private void Update()
 {
     UpdateArc();
     if (SteamVR_Actions.default_Teleport[SteamVR_Input_Sources.RightHand].stateDown && _isArcTargetValid)
     {
         _log.Append("isTeleporting", true);
         _teleporter.Teleport(_teleportMarker.transform.position);
     }
     _log.CommitLine();
 }
 public void Update()
 {
     if (OVRInput.GetDown(teleportButton, controller))
     {
         teleport.StartTeleport();
     }
     if (OVRInput.GetUp(teleportButton, controller))
     {
         teleport.Teleport();
     }
 }
Exemple #11
0
 private void Update()
 {
     if (_enteredObject != null)
     {
         Vector3 relativePosition = transform.InverseTransformPoint(_enteredObject.transform.position);
         if (relativePosition.z > 0.0f)
         {
             _enteredObject.Teleport();
         }
     }
 }
        private void CboxAreaTeleport_SelectedIndexChanged(object sender, EventArgs e)
        {
            var area = cboxAreaTeleport.SelectedItem.ToString().Area();

            if (area == null)
            {
                return;
            }

            Teleporter.Teleport(area);
        }
Exemple #13
0
 private void FixedUpdate()
 {
     if (!teleporting && teleportAction.GetState(handType))
     {
         teleporting = true;
         teleport.StartTeleport();
     }
     else if (teleporting && !teleportAction.GetState(handType))
     {
         teleporting = false;
         teleport.Teleport();
     }
 }
        public void FixedUpdate()
        {
            if (!aiming && OVRInput.Get(teleportButton, controller))
            {
                aiming = true;
                teleport.StartTeleport();
            }

            if (aiming && !OVRInput.Get(teleportButton, controller))
            {
                aiming = false;
                teleport.Teleport();
            }
        }
Exemple #15
0
    void OnTriggerEnter(Collider collider)
    {
        if (linkedTeleporter == null)
        {
            return;
        }

        GameObject obj = collider.gameObject;

        if (obj.tag == "Player")
        {
            Teleporter link = linkedTeleporter.GetComponent <Teleporter>();
            link.Teleport(obj);
        }
    }
Exemple #16
0
 public void Teleport(object[] obj)
 {
     Param[] set = (Param[])obj[1];
     switch (set.Length)
     {
         case 2:
             Teleporter.Teleport((float)set[0].obj, (float)set[1].obj);
             break;
         case 3:
             Teleporter.Teleport((float)set[0].obj, (float)set[1].obj, (float)set[2].obj);
             break;
         case 4:
             Teleporter.Teleport((float)set[0].obj, (float)set[1].obj, (float)set[2].obj, (float)set[3].obj);
             break;
         case 5:
             Teleporter.Teleport((float)set[0].obj, (float)set[1].obj, (float)set[2].obj, (float)set[3].obj, (float)set[4].obj);
             break;
     }
 }
Exemple #17
0
 public void Hide()
 {
     anim.SetTrigger("Toggle");
     teleporter.Teleport();
 }
Exemple #18
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        Vector2 input    = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
        int     wallDirX = (controller.collisions.left) ? -1 : 1;

        if (isAttacking) //Cannot move while attacking
        {
            input.x = 0;
            if (controller.collisions.below)
            {
                targetVelocityX = 0;
            }
        }

        if (!isAttacking) //Allow horizontal move while not attacking
        {
            targetVelocityX = input.x * moveSpeed;
        }

        velocity.x = Mathf.SmoothDamp(velocity.x, targetVelocityX, ref velocityXSmoothing, (controller.collisions.below) ? accelerationTimeGrounded : accelerationTimeAirorne);

        bool wallSliding = false;

        if ((controller.collisions.left || controller.collisions.right) && !controller.collisions.below && velocity.y < 0 &&
            controller.GetComponent <Controller2D>().canWallSlide)   //If is wall sliding
        {
            wallSliding             = true;
            accelerationTimeAirorne = 0.2f;
            moveSpeed  = initialMoveSpeed * 2;
            moveSpeed *= transform.localScale.x;

            if (velocity.y < -wallSlideSpeedMax && (controller.GetComponent <Controller2D>().autoWallSlide || velocity.x != 0)) //Set the maximum drop speed when sliding on wall
            {
                velocity.y = -wallSlideSpeedMax;
            }

            if (timeToWallUnstick > 0) //Give more wall grab time for jump to opposite side
            {
                velocityXSmoothing = 0;
                velocity.x         = 0;

                if (input.x != wallDirX && input.x != 0)
                {
                    timeToWallUnstick -= Time.deltaTime;
                }

                else
                {
                    timeToWallUnstick = wallStickTime;
                }
            }

            else
            {
                timeToWallUnstick = wallStickTime;
            }
        }

        if (controller.collisions.below) //Set physics when not wall sliding
        {
            accelerationTimeAirorne = 0;
            moveSpeed = initialMoveSpeed * transform.localScale.x;
        }

        if (controller.collisions.above || controller.collisions.below) //Stop accumulating gravity if is on ground & prevent going up through roof
        {
            velocity.y = 0;
        }

        if (Input.GetButtonDown("Jump") && !isAttacking && !isDodging)               //Jump logic
        {
            if (wallSliding && controller.GetComponent <Controller2D>().canWallJump) //Wall jump
            {
                //print("wall jump");
                if (wallDirX == input.x) //Wall Climb
                {
                    //print(wallDirX);
                    velocity.x = -wallDirX * wallJumpClimb.x;
                    //print(velocity.x);
                    velocity.y = wallJumpClimb.y;
                }

                else if (input.x == 0) //Jump off wall
                {
                    velocity.x = -wallDirX * wallJumpOff.x;
                    velocity.y = wallJumpOff.y;
                }

                else //Jump to opposite direction
                {
                    //print("else");
                    velocity.x = -wallDirX * wallLeap.x;
                    //print(velocity.x);
                    velocity.y = wallLeap.y;
                }
            }

            if (controller.collisions.below) //Jump from ground
            {
                //print("jump");
                velocity.y = jumpVelocity;
            }

            else if (!controller.collisions.below && jumpsRemaining > 0 && !wallSliding) //Air jump
            {
                velocity.y = jumpVelocity;
                jumpsRemaining--;
            }
        }

        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);

        if (wallSliding || controller.collisions.below) //Reset jump times
        {
            jumpsRemaining = jumpTimes - 1;
        }

        if (Input.GetButtonDown("Fire1") && !isAttacking && !isDodging) //Attack with light saber
        {
            //print("attack");
            isAttacking       = true;
            attackPrepSession = attackPrep();
            StartCoroutine(attackPrepSession);
        }

        else if (Input.GetKeyDown(KeyCode.Q) && isAttacking && isAttackPrep) //Cancel attack
        {
            StopCoroutine(attackPrepSession);
            isAttacking = false;
            CmdChangeColor(0);
            isAttackPrep = false;
        }

        if (Input.GetButtonDown("Fire2") && !isAttacking && !isDodging) //Dodge move
        {
            isDodging  = true;
            velocity.y = 0;
            teleporte.Teleport(aim.aimingDir, dodgeDistance, dodgeCollisionDetectDist);
            isDodging = false;
        }
    }
Exemple #19
0
    private void Update()
    {
        if (!_magManager.IsMagnifying)
        {
            return;
        }

        // Set + adjust position once per frame
        SetMarkerPosition();
        // If marker still collides after adjustment, target cannot be teleported to
        bool isTargetValid = IsTeleportTargetValid();

        _dotImage.SetValid(isTargetValid);

        _log.Append("targetValid", isTargetValid);

        SteamVR_Action_Boolean_Source triggerDown = SteamVR_Actions.default_GrabPinch[SteamVR_Input_Sources.RightHand];

        if (triggerDown.stateDown && !_teleporter.IsTeleporting)
        {
            if (isTargetValid)
            {
                _isHoldingTrigger = true;
                _holdDownTime     = 0f;

                SetTeleportTarget();
                _teleportMarker.SetAlpha(1f, 1f);
            }
            else
            {
                _teleportCandidate = null;
                _teleportMarker.SetAlpha(0f, 0f);
                _log.CommitLine();
                return;
            }
        }
        if (triggerDown.stateUp)
        {
            _isHoldingTrigger  = false;
            _teleportCandidate = null;
            _teleportMarker.SetAlpha(0f, 0f);
        }

        if (_isHoldingTrigger)
        {
            _holdDownTime += Time.deltaTime;
            _dotImage.SetProgress(_holdDownTime / _activationTime);
            if (_holdDownTime >= _activationTime)
            {
                _isHoldingTrigger = false;
                _log.Append("isTeleporting", true);

                // Start teleport
                _teleporter.Teleport(_teleportCandidate.Value);
                OnGazeTeleport(_teleportCandidate.Value);
                _teleportCandidate = null;
            }
        }
        else
        {
            _teleportMarker.SetAlpha(0f, 0f);
            _dotImage.SetProgress(1f);
        }
        _log.CommitLine();
    }
Exemple #20
0
 //Need this to subscribe to the event system for unique Locs
 public void confirmed()
 {
     _Active.Teleport(findSelected(), _shutDown);
 }
 void OnTriggerEnter(Collider other)
 {
     OtherEndTeleporter.Teleport(other.gameObject);
 }