/// <summary> /// Unity's method called right after the object is created. /// </summary> void Awake() { // Retrieves the desired components _ccc = GetComponentInParent<CharacterControllerCustom>(); _characterSize = GetComponentInParent<CharacterSize>(); _characterShoot = GetComponentInParent<CharacterShoot>(); _characterShootTrajectory = GetComponentInParent<CharacterShootTrajectory>(); _eyesAttacher = GetComponent<EyesAttacher>(); _transform = transform; _parent = _transform.parent; // Saves the model offset _originalModelOffset = _transform.localPosition; // Gets the joint information _joints = GetComponentsInChildren<Joint>(); _jointsConnectedBodies = _joints.Select(e => e.connectedBody).ToArray(); _originalJointsPosition = _joints.Select(e => e.transform.localPosition).ToArray(); }
/// <summary> /// Unity's method called when the entity is created. /// Recovers the desired componentes of the entity. /// </summary> public void Awake() { ccc = GetComponent<CharacterControllerCustom>(); _shootTrajectory = GetComponent<CharacterShootTrajectory>(); size = GetComponent<CharacterSize>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); }