Esempio n. 1
0
        public void AddControllingCharacter(CCharacterBase character)
        {
            if (this._characters.Contains(character))
            {
                Debug.LogError($"Will not add {character.name} to player {this.PlayerNumber} control because it is already controlling it!");
                return;
            }

            this._characters.Add(character);
        }
Esempio n. 2
0
 public List <GameObject> GetAllGameObjectsRelatedToCharacter(CCharacterBase characterBase)
 {
     foreach (var player in this._gamePlayers)
     {
         if (!player.IsControllingCharacter(characterBase))
         {
             continue;
         }
         return(player.GetAllRelatedGameObjects());
     }
     return(new List <GameObject>());
 }
Esempio n. 3
0
        private void Awake()
        {
            this._blockingEventsManager = CDependencyResolver.Get <CBlockingEventsManager>();
            this._transform             = this.transform;

            this._characterBase = this.GetComponent <CCharacterBase>();
            if (this._characterBase == null)
            {
                Debug.LogError($"Cant find any Character on {this.name}, removing component, character cannot interact with anything!");
                Destroy(this);
            }
        }
Esempio n. 4
0
        private (Vector3 camF, Vector3 camR) GetCameraVectorsRelativeToCharacter(CCharacterBase relativeTo)
        {
            if (this._cameraTransform == null)
            {
                return(Vector3.forward, Vector3.right);
            }

            var camF = relativeTo.Position - this._cameraTransform.position;

            camF.y = 0;
            camF.Normalize();

            var camR = -Vector3.Cross(camF, Vector3.up);

            camR.y = 0;
            camR.Normalize();

            return(camF, camR);
        }
Esempio n. 5
0
 public CGamePlayer GetPlayerControllingCharacter(CCharacterBase characterBase)
 {
     return(this._gamePlayers.FirstOrDefault(player => player.IsControllingCharacter(characterBase)));
 }
Esempio n. 6
0
 public bool IsControllingCharacter(CCharacterBase characterBase)
 {
     return(this._characters.Contains(characterBase));
 }