Пример #1
0
    public void SmoothDamp(bool stopDestSelect = true)
    {
        if (isSelecting && destinationTarget == null)
        {
            return;
        }
        finalDestination           = LocomoteDestinationFromFloor(destinationPosition);
        finalRotation              = destinationRotation;
        totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination);
        locomotionType             = LocomotionType.SmoothDamp;
        lastJoystickAngle          = 0f;
        ChangePlayerMovement(false, false);
        m_characterController.enabled = false;
        foreach (Rigidbody rb in m_rbs)
        {
            rb.isKinematic = false;
        }

        teleported    = false;
        isTeleporting = true;
        if (stopDestSelect)
        {
            StopSelectDestination();
        }
    }
Пример #2
0
    public void Instant(bool stopDestSelect = true)
    {
        // If we're currently selecting, we'll grab the target position from destinationPosition
        if (isSelecting && destinationTarget == null)
        {
            return;
        }
        finalDestination           = LocomoteDestinationFromFloor(destinationPosition);
        finalRotation              = destinationRotation;
        totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination);
        locomotionType             = LocomotionType.Instant;

        lastJoystickAngle = 0f;
        ChangePlayerMovement(false, false);
        foreach (Rigidbody rb in m_rbs)
        {
            rb.isKinematic = false;
        }

        teleported    = false;
        isTeleporting = true;
        if (stopDestSelect)
        {
            StopSelectDestination();
        }
    }
Пример #3
0
        public void ChangeLocomotion(LocomotionType locomotionType, bool save)
        {
            player.ChangeLocomotionType(locomotionType);

            if (save)
            {
                PlayerPrefs.SetInt("LocomotionSelection", locomotionType == LocomotionType.Teleport ? 0 : 1);
            }

            UpdateTeleportStatus();
        }
Пример #4
0
 public void StopLocomotion()
 {
     // m_screenFader.SetFadeLevel(0);
     m_screenFader.SetExplicitFade(0);
     velocity      = Vector3.zero;
     teleported    = true;
     isTeleporting = false;
     m_characterController.enabled = true;
     ResetPlayerMovement();
     locomotionType = LocomotionType.None;
 }
        public void ChangeLocomotionType(LocomotionType loc)
        {
            selectedLocomotion = loc;

            if (teleport == null)
            {
                teleport = GetComponent <PlayerTeleport>();
            }

            toggleTeleport(selectedLocomotion == LocomotionType.Teleport);
            toggleSmoothLocomotion(selectedLocomotion == LocomotionType.SmoothLocomotion);
        }
Пример #6
0
    public void TranslateLikeJoystick()
    {
        locomotionType    = LocomotionType.TranslateLikeJoystick;
        lastJoystickAngle = 0f;
        ChangePlayerMovement(false, true);
        m_characterController.enabled = false;
        foreach (Rigidbody rb in m_rbs)
        {
            rb.isKinematic = false;
        }

        teleported    = false;
        isTeleporting = true;
    }
Пример #7
0
 public void ManualTranslateTarget(Vector3 dest, Quaternion rot)
 {
     finalDestination  = LocomoteDestinationFromFloor(dest);
     finalRotation     = rot;
     locomotionType    = LocomotionType.TranslateTarget;
     lastJoystickAngle = 0f;
     ChangePlayerMovement(false, false);
     m_characterController.enabled = false;
     foreach (Rigidbody rb in m_rbs)
     {
         rb.isKinematic = false;
     }
     teleported    = false;
     isTeleporting = true;
 }
Пример #8
0
 public void ManualSmoothDamp(Vector3 dest, Quaternion rot)
 {
     finalDestination           = LocomoteDestinationFromFloor(dest);
     finalRotation              = rot;
     totalDistanceToDestination = Vector3.Distance(m_charTransform.position, finalDestination);
     locomotionType             = LocomotionType.SmoothDamp;
     lastJoystickAngle          = 0f;
     ChangePlayerMovement(false, false);
     m_characterController.enabled = false;
     foreach (Rigidbody rb in m_rbs)
     {
         rb.isKinematic = false;
     }
     teleported    = false;
     isTeleporting = true;
 }
Пример #9
0
        public void ChangeLocomotionType(LocomotionType loc)
        {
            // Make sure Smooth Locomotion is available
            if (smoothLocomotion == null)
            {
                smoothLocomotion = GetComponent <SmoothLocomotion>();
            }

            selectedLocomotion = loc;

            if (teleport == null)
            {
                teleport = GetComponent <PlayerTeleport>();
            }

            toggleTeleport(selectedLocomotion == LocomotionType.Teleport);
            toggleSmoothLocomotion(selectedLocomotion == LocomotionType.SmoothLocomotion);
        }
Пример #10
0
    protected void Stop()
    {
        if (Agent.isOnNavMesh && Agent.enabled)
        {
            Agent.destination = Player.transform.position;
        }

        Locomotion.jump = false;
        Speed           = 0;
        Direction       = 0;
        motionType      = LocomotionType.normal;
        Locomotion.ResetHoldTugAnimator();
        Locomotion.ResetSpeedMultiples();

        player.GetTugOfWar().RemoveJoint();
        Player.GetComponent <Rigidbody>().velocity    = Vector3.zero;
        Player.GetComponent <Animator>().rootPosition = Player.transform.position;
        isForcedGoTo = false;
        forceGoTo    = Player.transform.position;
    }
Пример #11
0
    public virtual void ForceGoTo(Vector3 position, Transform loockat)
    {
        if (isForcedGoTo)
        {
            return;
        }

        if (!Agent.isOnNavMesh && !Agent.enabled)
        {
            return;
        }

        Stop();

        this.motionType = LocomotionType.strafe;

        isForcedGoTo      = true;
        forceLoockat      = loockat;
        forceGoTo         = position;
        Agent.destination = forceGoTo;
    }
Пример #12
0
        public void ChangeLocomotionType(LocomotionType loc)
        {
            selectedLocomotion = loc;

            if (teleport == null)
            {
                teleport = GetComponent <PlayerTeleport>();
            }

            if (selectedLocomotion == LocomotionType.Teleport)
            {
                teleport.EnableTeleportation();
            }
            else if (selectedLocomotion == LocomotionType.SmoothLocomotion)
            {
                teleport.DisableTeleportation();
            }
            // Default to Disable All
            else
            {
                // Disable all
                teleport.DisableTeleportation();
            }
        }
Пример #13
0
 public SoccerAIGeneric(AIController owner, PlayerController controller)
 {
     this.owner  = owner;
     this.player = controller;
     motionType  = LocomotionType.normal;
 }