Example #1
0
 private void Start()
 {
     if (!cc)
     {
         cc = GetComponent <CharacterControl>();
     }
     agent = GetComponentInChildren <NavMeshAgent>();
     // obstacle = GetComponent<NavMeshObstacle>();
     if (pathTarget)
     {
         pathTarget.transform.SetParent(null);
     }
     if (target)
     {
         SetTarget(target);
     }
     agent.updateRotation = false;
     if (isPlayer)
     {
         agent.updatePosition = false;
     }
 }
Example #2
0
        public bool RegisterCharacter(Character character, CharacterControl instance)
        {
            if (!activeCharacters.Contains(character))
            {
                activeCharacters.Add(character);
                charInstanceDict.Add(character, instance);
                instance.charEquip?.Start();
                CharacterCustomize.I.ApplyCustomizationsOnCharacterSpawn(character, instance.gameObject);
                onCharacterRegistered?.Invoke(instance);

                // PlayerController player = instance.GetComponent<PlayerController>();
                // if(player && !players.Contains(player))
                //     players.Add(player);
                if (instance.CompareTag("Player"))
                {
                    Player = instance;
                    onPlayerRegistered?.Invoke(Player);
                }

                return(true);
            }
            return(false);
        }