ターゲットの位置に瞬間移動するクラス
상속: MonoBehaviour
예제 #1
0
    public override void Start()
    {
        base.Start();

        _teleportation        = GetComponent <Teleportation>();
        _movement             = GetComponent <SidescrollingMovement>();
        _hitboxes             = GetComponentInChildren <HitboxController>();
        _spiralProjectileSpam = GetComponent <SpiralProjectileSpam>();

        _actions = new List <Action>
        {
            MoveToPlayer,
            AttackPlayer,
            TeleportBehindPlayer,
            MoveToPlayer,
            AttackPlayer,
            TeleportToCenter,
            SpamMagic,
            TeleportBehindPlayer,
        };

        _originalPosition = transform.position;
        _currentAnimation = IdleLeft;
        _isFacingLeft     = true;
    }
예제 #2
0
    private void Awake()
    {
        controller = GetComponent <SteamVR_TrackedObject>();
        //originalScale = dnaChain1.transform.localScale;

        //abandonShipText = textMeshAbandonShip.GetComponent<TextMeshPro>();


        teleportScript = GetComponent <Teleportation>();

        selfDestructScript = selfDestructionTimer.GetComponentInChildren <SelfDestructionCountdown>();


        dnaChainTemp1 = dnaChain1a;
        dnaChainTemp1.SetActive(false);


        dnaChainTemp2 = dnaChain2a;
        dnaChainTemp2.SetActive(false);

        originalScale = dnaChainTemp1.transform.localScale;

        dnaChain1b.SetActive(false);
        dnaChain2b.SetActive(false);

        col = pointerSphere.GetComponent <SphereCollider>();
    }
예제 #3
0
        public static void GetInput(Player player, Map map, string _type)
        {
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Enter Letter:");

            //int i = Convert.ToInt32(Console.ReadLine());
            ConsoleKey cInput = Console.ReadKey(true).Key; //true hides input

            if (cInput == ConsoleKey.Escape)
            {
                return; //? is this the correct way to do this
            }

            int i = (int)cInput - 65; //a == 0

            if (_type == "potion")
            {
                if (PotionInventory[i].Name == "Health Potion" && Health.Cast(player))
                {
                    PotionInventory.RemoveAt(i);
                }
            }
            if (_type == "scroll")
            {
                if (ScrollInventory[i].Name == "Teleportation Scroll")
                {
                    Teleportation.Cast(player, map);
                }

                ScrollInventory.RemoveAt(i);
            }
        }
예제 #4
0
        void ITeleportationTrigger.PadClicked(Teleportation teleportation)
        {
            var arrivalHelp = Instantiate(_onTeleportationArrivalOrientationPrefab);

            arrivalHelp.SetAnnotationData(GetTargetGizmo().Annotation);
            SelectionManager.Instance.SetSelectedItem(GetTargetGizmo());
            teleportation.JumpToPosition(GetTeleportationTarget(GetTargetGizmo()));
        }
예제 #5
0
    private void Awake()
    {
        netsScript     = GetComponent <NETSv1>();
        teleportScript = GetComponent <Teleportation>();
        wShiftScript   = GetComponent <WeaponShift>();

        rendNets = netsButton.GetComponent <Renderer>();
    }
예제 #6
0
 public static Scroll Scroll()
 {
     switch (1)
     {
     case 1:
         Teleportation teleportation = new Teleportation();
         return(teleportation);
     }
     //return null;
 }
예제 #7
0
    private void Awake()
    {
        guideAudioS2     = GetComponent <AudioSource>();
        mm4Script        = GetComponent <MagicMoveV4>();
        capsIngestScript = leftController.GetComponent <CapsulatedIngestionV2>();
        pcolScript       = particleWeapon.GetComponent <ParticleCollision>();

        teleportScriptR = GetComponent <Teleportation>();
        teleportScriptL = leftController.GetComponent <Teleportation>();

        animEndGameNote = endGameNote.GetComponent <Animator>();
    }
예제 #8
0
        public void GoToPreviousAnnotation(Teleportation teleportation)
        {
            var selectedAnnotationGizmo = SelectionManager.Instance.SelectedAnnotationGizmo;

            if (selectedAnnotationGizmo == null)
            {
                return;
            }

            var nextGizmo = GetPreviousAnnotationGizmoOnNode(selectedAnnotationGizmo);

            SelectionManager.Instance.SetSelectedItem(nextGizmo);
            teleportation.JumpToPosition(nextGizmo.Annotation.ViewPortPosition.position);
        }
예제 #9
0
 private void OnTriggerEnter2D(Collider2D obj)
 {
     if (obj.gameObject.name.Contains("teleport"))
     {
         tl = obj.gameObject.GetComponent <Teleportation>();
         //this.transform.position = new Vector2(obj.gameObject.GetComponent<Teleportation>().newX,obj.gameObject.GetComponent<Teleportation>().newY);
         if (tl == null)
         {
             return;
         }
         this.transform.position = new Vector2(tl.newX, tl.newY);
         return;
     }
     itemToPickUp = obj.gameObject;
     Hud.OpenMessagePanel(obj.gameObject.name);
 }
예제 #10
0
        static void Main(string[] args)
        {
            var trues  = 0;
            var falses = 0;
            var equals = 0;
            var random = new Random();

            using (var qsim = new QuantumSimulator())
            {
                for (int k = 0; k < 1000; k++)
                {
                    var sentMessage = random.Next(2) == 0;

                    // What Jane received
                    var receivedMessage = Teleportation.Run(qsim, sentMessage).Result;

                    if (receivedMessage)
                    {
                        trues++;
                    }
                    else
                    {
                        falses++;
                    }

                    if (sentMessage == receivedMessage)
                    {
                        equals++;
                    }
                }
            }

            Console.WriteLine("==============================================");
            Console.WriteLine("========= Transportation Calculations ==========");
            Console.WriteLine("==============================================");
            Console.WriteLine();
            Console.WriteLine($"Number of TRUEs: {trues} Number of FALSEs: {falses}");
            Console.WriteLine($"How many received messages matched the sent: {equals}");

            Console.WriteLine($"Different values are sent and the same values are received.");
            Console.WriteLine();

            Console.ReadKey();
        }
예제 #11
0
    public override void Start()
    {
        base.Start();

        _teleportation        = GetComponent <Teleportation>();
        _boxController        = GetComponentInChildren <HitboxController>();
        _spiralProjectileSpam = GetComponent <SpiralProjectileSpam>();

        _states = new List <Action> {
            TeleportToAnchor,
            ConjureProjectile,
            LaunchProjectileAtPlayer,
            WatchTheBolt,
            TeleportToAnchor,
            ConjureProjectile,
            SpamMagic,
            WatchTheBolt,
        };

        _facingLeft = true;
        _animation  = IdleLeft;
    }
예제 #12
0
 void ITeleportationTrigger.PadUnclicked(Teleportation teleportation)
 {
 }
예제 #13
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject aOtherObject;

        aOtherObject = other.gameObject;

        MoveByTouch aCharacter;

        aCharacter = aOtherObject.GetComponent <MoveByTouch>();

        if (aCharacter != null)
        {
            if (SwitchHits == 1)
            {
                thisMeshrenderer.material = thisSwitchBlue;
            }

            if (SwitchHits == 0)
            {
                thisMeshrenderer.material = thisEmmisiveSwitchBlue;
            }

            if (Level1SideSwitchForFrontDoor)
            {
                if (SwitchHits == 0)
                {
                    Teleportation aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();

                    aTeleportation.Level1SideSwitchForFrontDoor = true;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = true;
                }

                if (SwitchHits == 1)
                {
                    Teleportation aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();

                    aTeleportation.Level1SideSwitchForFrontDoor = false;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = false;
                }
            }

            if (Level1GroundSwitchFor2ndFloor)
            {
                if (SwitchHits == 0)
                {
                    Teleportation aTeleportation = Level2Side.GetComponent <Teleportation>();

                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;
                    aTeleportation.thisS3Switch = false;

                    aTeleportation = Level3Side.GetComponent <Teleportation>();

                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;
                    aTeleportation.thisS3Switch = false;
                }

                if (SwitchHits == 1)
                {
                    Teleportation aTeleportation = Level2Side.GetComponent <Teleportation>();
                    aTeleportation.Level1GroundSwitchFor2ndFloor = false;

                    aTeleportation = Level3Side.GetComponent <Teleportation>();
                    aTeleportation.Level1GroundSwitchFor2ndFloor = false;
                }
            }

            if (Level2BackDoorSwitch)
            {
                print(SwitchHits);

                if (SwitchHits == 0)
                {
                    Teleportation aTeleportation = Level2BackDoor.GetComponent <Teleportation>();


                    aTeleportation.Level2BackDoorSwitch = true;

                    aTeleportation = Level1SideDoor.GetComponent <Teleportation>();
                    aTeleportation.Level2BackDoorSwitch = true;
                }

                if (SwitchHits == 1)
                {
                    Teleportation aTeleportation = Level2BackDoor.GetComponent <Teleportation>();


                    aTeleportation.Level2BackDoorSwitch = false;

                    aTeleportation = Level1SideDoor.GetComponent <Teleportation>();
                    aTeleportation.Level2BackDoorSwitch = false;
                }
            }

            if (Level2FrontDoorSwitch)
            {
                if (SwitchHits == 0)
                {
                    Switches aEffectedSwitch = B4Switch.GetComponent <Switches>();

                    if (aEffectedSwitch.SwitchHits == 1)
                    {
                        Teleportation aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                        aTeleportation.Level2FrontDoorSwitch        = true;
                        aTeleportation.Level1SideSwitchForFrontDoor = false;

                        aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();
                        aTeleportation.Level1SideSwitchForFrontDoor = false;

                        Switches aDifferentSwitch = SideSwitchForFrontDoor.GetComponent <Switches>();
                        aDifferentSwitch.SwitchHits = 0;

                        aTeleportation = Level3Front.GetComponent <Teleportation>();
                        aTeleportation.Level2FrontDoorSwitch = true;


                        aTeleportation = Level4Side.GetComponent <Teleportation>();
                        aTeleportation.Level2FrontDoorSwitch = true;
                    }
                }

                if (SwitchHits == 1)
                {
                    Teleportation aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();

                    aTeleportation.Level1SideSwitchForFrontDoor = true;
                    aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = true;
                }
            }


            if (thisS3Switch)
            {
                if (SwitchHits == 0)
                {
                    Switches aEffectedSwitch = GroundSwitchFor2ndFloor.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 0;

                    aEffectedSwitch            = B2DoorSwitch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 0;

                    Teleportation aTeleportation = Level3Side.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = true;
                    aTeleportation.Level1GroundSwitchFor2ndFloor = false;
                    aTeleportation.thisB4Switch = false;

                    aTeleportation = Level2Side.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = true;
                    aTeleportation.Level1GroundSwitchFor2ndFloor = false;

                    aTeleportation = Level1BackDoor.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = true;

                    aTeleportation = Level2BackDoor.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = true;

                    aTeleportation = Level4Back.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = true;
                }

                if (SwitchHits == 1)
                {
                    Switches aEffectedSwitch = GroundSwitchFor2ndFloor.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 1;

                    aEffectedSwitch            = B2DoorSwitch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 1;

                    Teleportation aTeleportation = Level3Side.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = false;
                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;
                    aTeleportation.thisB4Switch = false;

                    aTeleportation = Level2Side.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = false;
                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;

                    aTeleportation = Level1BackDoor.GetComponent <Teleportation>();

                    aTeleportation.thisS3Switch = false;

                    aTeleportation = Level2Side.GetComponent <Teleportation>();

                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;
                    aTeleportation.thisS3Switch = false;

                    aTeleportation = Level3Side.GetComponent <Teleportation>();

                    aTeleportation.Level1GroundSwitchFor2ndFloor = true;
                    aTeleportation.thisS3Switch = false;

                    aTeleportation = Level4Back.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = false;
                }
            }



            if (thisB4Switch)
            {
                if (SwitchHits == 0)
                {
                    Switches aEffectedSwitch = GroundSwitchFor2ndFloor.GetComponent <Switches>();
                    aEffectedSwitch            = S3Switch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 0;

                    Teleportation aTeleportation = Level3Side.GetComponent <Teleportation>();
                    aTeleportation.thisB4Switch = true;
                    aTeleportation.thisS3Switch = false;

                    aTeleportation = Level4Back.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = false;
                    aTeleportation.thisB4Switch = true;

                    aTeleportation = Level2Side.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = false;
                    aTeleportation.thisB4Switch = true;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.thisB4Switch = true;
                }

                if (SwitchHits == 1)
                {
                    Switches aEffectedSwitch = GroundSwitchFor2ndFloor.GetComponent <Switches>();
                    aEffectedSwitch            = S3Switch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 1;

                    Teleportation aTeleportation = Level3Side.GetComponent <Teleportation>();
                    aTeleportation.thisB4Switch = false;
                    aTeleportation.thisS3Switch = true;

                    aTeleportation = Level4Back.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = true;
                    aTeleportation.thisB4Switch = false;

                    aTeleportation = Level2Side.GetComponent <Teleportation>();
                    aTeleportation.thisS3Switch = true;
                    aTeleportation.thisB4Switch = false;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.thisB4Switch = false;
                }
            }

            if (thisS4Switch)
            {
                if (SwitchHits == 0)
                {
                    Switches aEffectedSwitch = B2FrontDoorSwitch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 0;

                    Teleportation aTeleportation = Level3Front.GetComponent <Teleportation>();
                    aTeleportation.thisS4Switch          = true;
                    aTeleportation.Level2FrontDoorSwitch = false;

                    aTeleportation = Level5Top.GetComponent <Teleportation>();
                    aTeleportation.thisS4Switch = true;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = true;

                    aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = true;
                }

                if (SwitchHits == 1)
                {
                    Switches aEffectedSwitch = B2FrontDoorSwitch.GetComponent <Switches>();
                    aEffectedSwitch.SwitchHits = 1;

                    Teleportation aTeleportation = Level3Front.GetComponent <Teleportation>();
                    aTeleportation.thisS4Switch = false;

                    aTeleportation = Level5Top.GetComponent <Teleportation>();
                    aTeleportation.thisS4Switch = false;

                    aTeleportation = Level2FrontDoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = false;
                    aTeleportation = Level1Frontdoor.GetComponent <Teleportation>();
                    aTeleportation.Level1SideSwitchForFrontDoor = false;
                }
            }
        }
    }
예제 #14
0
 private void GrabTeleportation()
 {
     playerTeleportation = playerGameObject.GetComponent <Teleportation>();
 }
예제 #15
0
 private void Awake()
 {
     Instance = this;
 }
예제 #16
0
        //-------------------------------------------------
        public void ShowTeleportHint()
        {
            CancelTeleportHint();

            /* custom changes by Mars Motion */ if (gameObject.activeSelf)
            {
                /**/ hintCoroutine = StartCoroutine(TeleportHintCoroutine()); /* custom changes by Mars Motion */
            }                                                                 /**/
        }

        //-------------------------------------------------
        public void CancelTeleportHint()
        {
            if (hintCoroutine != null)
            {
                foreach (Hand hand in player.hands)
                {
                    ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad);
                }

                StopCoroutine(hintCoroutine);
                hintCoroutine = null;
            }

            CancelInvoke("ShowTeleportHint");
        }

        //-------------------------------------------------
        private IEnumerator TeleportHintCoroutine()
        {
            float prevBreakTime       = Time.time;
            float prevHapticPulseTime = Time.time;

            while (true)
            {
                bool pulsed = false;

                //Show the hint on each eligible hand
                foreach (Hand hand in player.hands)
                {
                    bool showHint      = IsEligibleForTeleport(hand);
                    bool isShowingHint = !string.IsNullOrEmpty(ControllerButtonHints.GetActiveHintText(hand, EVRButtonId.k_EButton_SteamVR_Touchpad));
                    if (showHint)
                    {
                        if (!isShowingHint)
                        {
                            ControllerButtonHints.ShowTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad, "Teleport");
                            prevBreakTime       = Time.time;
                            prevHapticPulseTime = Time.time;
                        }

                        if (Time.time > prevHapticPulseTime + 0.05f)
                        {
                            //Haptic pulse for a few seconds
                            pulsed = true;

                            hand.controller.TriggerHapticPulse(500);
                        }
                    }
                    else if (!showHint && isShowingHint)
                    {
                        ControllerButtonHints.HideTextHint(hand, EVRButtonId.k_EButton_SteamVR_Touchpad);
                    }
                }

                if (Time.time > prevBreakTime + 3.0f)
                {
                    //Take a break for a few seconds
                    yield return(new WaitForSeconds(3.0f));

                    prevBreakTime = Time.time;
                }

                if (pulsed)
                {
                    prevHapticPulseTime = Time.time;
                }

                yield return(null);
            }
        }

        //-------------------------------------------------
        public bool IsEligibleForTeleport(Hand hand)
        {
            /* custom changes by Mars Motion */
            Hand.HandType handType = hand.GuessCurrentHandType();

            if (handType == Hand.HandType.Left)
            {
                if (!Teleporter.left || !Teleporter.left.enabled || !Teleporter.left.gameObject || !Teleporter.left.gameObject.activeSelf || !Teleporter.left.locomotionDependencies.areMet())
                {
                    return(false);
                }
            }
            else
            {
                if (!Teleporter.right || !Teleporter.right.enabled || !Teleporter.right.gameObject || !Teleporter.right.gameObject.activeSelf || !Teleporter.right.locomotionDependencies.areMet())
                {
                    return(false);
                }
            }

            if (!Teleportation.enabledLocomotion())
            {
                return(false);
            }

            /**/ if (hand == null)
            {
                return(false);
            }

            if (!hand.gameObject.activeInHierarchy)
            {
                return(false);
            }

            if (hand.hoveringInteractable != null)
            {
                return(false);
            }

            if (hand.noSteamVRFallbackCamera == null)
            {
                if (hand.controller == null)
                {
                    return(false);
                }

                //Something is attached to the hand
                if (hand.currentAttachedObject != null)
                {
                    AllowTeleportWhileAttachedToHand allowTeleportWhileAttachedToHand = hand.currentAttachedObject.GetComponent <AllowTeleportWhileAttachedToHand>();

                    if (allowTeleportWhileAttachedToHand != null && allowTeleportWhileAttachedToHand.teleportAllowed == true)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #17
0
 private void Start()
 {
     Teleportation.AddPoint(Name, new PosAndRot(new Vector3(transform.position.x, transform.position.y - 2f, transform.position.z), transform.rotation));
 }