Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the default values.
        /// </summary>
        private void Start()
        {
            m_Transform           = transform;
            m_CharacterLocomotion = GetComponent <UltimateCharacterLocomotion>();
            m_AgentMovement       = m_CharacterLocomotion.GetAbility <AgentMovement>();
            m_UseAbility          = m_CharacterLocomotion.GetAbility <Use>();
            m_LocalLookSource     = GetComponent <LocalLookSource>();

            m_AgentMovement.Enabled = false;
            enabled = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The ability has started.
        /// </summary>
        protected override void AbilityStarted()
        {
            base.AbilityStarted();

            // The opponent should play an animation which responds to the counter attack.
            var opponentResponseAbility = m_OpponentLocomotion.GetAbility <MeleeCounterAttackResponse>();

            if (opponentResponseAbility == null)
            {
                return;
            }

            var substateIndex = -1;

            for (int i = 0; i < m_Inventory.SlotCount; ++i)
            {
                substateIndex = GetItemSubstateIndex(i);
                if (substateIndex != -1)
                {
                    break;
                }
            }
            if (substateIndex != -1)
            {
                opponentResponseAbility.StartResponse(substateIndex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Removes the specified ability from the ability array.
        /// </summary>
        /// <param name="characterLocomotion">The character to remove the ability from.</param>
        public static void RemoveAbility <T>(UltimateCharacterLocomotion characterLocomotion) where T : Ability
        {
            var ability = characterLocomotion.GetAbility <T>();

            if (ability != null)
            {
                RemoveAbility(characterLocomotion, ability);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Activates the specified demo zone.
        /// </summary>
        /// <param name="demoZone">The demo zone to active.</param>
        /// <param name="teleport">Should the character be teleported to the demo zone?</param>
        private void ActiveDemoZone(DemoZone demoZone, bool teleport)
        {
            // The ride ability should be force stopped.
            var ride = m_CharacterLocomotion.GetAbility <UltimateCharacterController.Character.Abilities.Ride>();

            if (ride != null && ride.IsActive)
            {
                m_CharacterLocomotion.TryStopAbility(ride, true);
            }
            if (m_ActiveZoneIndices.Count == 0 || m_ActiveZoneIndices[m_ActiveZoneIndices.Count - 1] != demoZone.Index)
            {
                m_ActiveZoneIndices.Add(demoZone.Index);
            }
            m_LastZoneIndex = demoZone.Index;
            ShowText(demoZone.Header, demoZone.Description, demoZone.Action);
            if (m_PreviousZoneArrow != null)
            {
                m_PreviousZoneArrow.SetActive(demoZone.Index != 0);
            }
            if (m_NextZoneArrow != null)
            {
                m_NextZoneArrow.SetActive(demoZone.Index != m_DemoZones.Length - 1);
            }
            m_EnterFrame = Time.frameCount;
            for (int i = 0; i < demoZone.EnableObjects.Length; ++i)
            {
                demoZone.EnableObjects[i].enabled = true;
            }
            for (int i = 0; i < demoZone.ToggleObjects.Length; ++i)
            {
                demoZone.ToggleObjects[i].SetActive(true);
            }

            // When the character reaches the outside section all doors should be unlocked.
            if (!m_AddOnDemoManager && !m_FullAccess && demoZone.Index >= m_DemoZones.Length - 6)
            {
                for (int i = 0; i < m_Doors.Count; ++i)
                {
                    m_Doors[i].CloseOnTriggerExit = false;
                    m_Doors[i].OpenClose(true, true, false);
                }
                m_FullAccess = true;
            }

            if (teleport)
            {
                var position = Vector3.zero;
                var rotation = Quaternion.identity;
                SpawnPointManager.GetPlacement(m_Character, demoZone.Index, ref position, ref rotation);
                m_CharacterLocomotion.SetPositionAndRotation(position, rotation, true);
            }

            // Set the group after the state so the default state doesn't override the grouping value.
            m_CharacterRespawner.Grouping = demoZone.Index;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes the MovementType.
        /// </summary>
        /// <param name="characterLocomotion">The reference to the character locomotion component.</param>
        public override void Initialize(UltimateCharacterLocomotion characterLocomotion)
        {
            base.Initialize(characterLocomotion);

            m_PlayerInput         = characterLocomotion.gameObject.GetCachedComponent <PlayerInput>();
            m_LayerManager        = characterLocomotion.gameObject.GetCachedComponent <CharacterLayerManager>();
            m_PathfindingMovement = characterLocomotion.GetAbility <PathfindingMovement>();
            if (m_PathfindingMovement == null)
            {
                Debug.LogError("Error: The Point Click Movement Type requires a PathfindingMovement ability.");
                return;
            }
            if (m_CharacterLocomotion.MoveTowardsAbility == null)
            {
                Debug.LogError("Error: The Point Click Movement Type requires the MoveTowards ability.");
                return;
            }
            m_SpeedChange = characterLocomotion.GetAbility <SpeedChange>();
            m_MinPointClickDistanceSqr = m_MinPointClickDistance * m_MinPointClickDistance;
        }