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); }
public List <GameObject> GetAllGameObjectsRelatedToCharacter(CCharacterBase characterBase) { foreach (var player in this._gamePlayers) { if (!player.IsControllingCharacter(characterBase)) { continue; } return(player.GetAllRelatedGameObjects()); } return(new List <GameObject>()); }
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); } }
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); }
public CGamePlayer GetPlayerControllingCharacter(CCharacterBase characterBase) { return(this._gamePlayers.FirstOrDefault(player => player.IsControllingCharacter(characterBase))); }
public bool IsControllingCharacter(CCharacterBase characterBase) { return(this._characters.Contains(characterBase)); }