Beispiel #1
0
 /// <summary>
 /// Initialize the default values.
 /// </summary>
 public override void Awake()
 {
     m_PathfindingMovement = m_CharacterLocomotion.GetAbility <PathfindingMovement>();
     if (m_PathfindingMovement != null && m_PathfindingMovement.Index > Index)
     {
         Debug.LogWarning("Warning: The Pathfinding Movement ability should be ordered above the Move Towards ability.");
     }
     m_SpeedChangeAbilities = m_CharacterLocomotion.GetAbilities <SpeedChange>();
 }
    public void SpawnAnt()
    {
        GameObject          ant     = Instantiate(antPrefab, spawnPoints[Random.Range(0, spawnPoints.Count)].position, Quaternion.identity);
        PathfindingMovement pathing = ant.GetComponent <PathfindingMovement>();
        GameObject          item;

        int rand = Random.Range(0, 3);

        if (rand == 0)
        {
            item = Instantiate(item1, itemPositions[Random.Range(0, itemPositions.Count)].position, Quaternion.identity);
            if (pathing != null)
            {
                pathing.goGetItem = PathfindingMovement.Item.Baby;
            }
        }
        else if (rand == 1)
        {
            item = Instantiate(item2, itemPositions[Random.Range(0, itemPositions.Count)].position, Quaternion.identity);
            if (pathing != null)
            {
                pathing.goGetItem = PathfindingMovement.Item.Blueb;
            }
        }
        else if (rand == 2)
        {
            item = Instantiate(item3, itemPositions[Random.Range(0, itemPositions.Count)].position, Quaternion.identity);
            if (pathing != null)
            {
                pathing.goGetItem = PathfindingMovement.Item.Leaf;
            }
        }
        else
        {
            item = Instantiate(item4, itemPositions[Random.Range(0, itemPositions.Count)].position, Quaternion.identity);
            if (pathing != null)
            {
                pathing.goGetItem = PathfindingMovement.Item.Strawb;
            }
        }

        if (pathing != null)
        {
            pathing.target = item.transform;
        }
    }
Beispiel #3
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;
        }
Beispiel #4
0
 /// <summary>
 /// Initialize the default values.
 /// </summary>
 public override void Awake()
 {
     m_PathfindingMovement  = m_CharacterLocomotion.GetAbility <PathfindingMovement>();
     m_SpeedChangeAbilities = m_CharacterLocomotion.GetAbilities <SpeedChange>();
 }