public void OnBeginJump(CharacterControllerCustom ccc, float delay) { // Sets the jump animation's delay on the animator _animator.SetFloat(CharacterAnimatorParameters.JumpDelay, 1.0f / delay); // Sets the jump trigger on the animator _animator.SetTrigger(CharacterAnimatorParameters.BeginJump); }
public void OnWallJump(CharacterControllerCustom ccc) { // Since to wall jump the character needs to be sliding, uses the slide effect position if (_slideEffect != null) wallJump.PlayEffect(_slideEffect.transform.position, _slideEffect.transform.rotation, _characterSize.GetSize()); }
public void OnPostCollision(CharacterControllerCustom ccc, ControllerColliderHit hit) { if (hit.collider.CompareTag(Tags.Player)) return; _colliderLayer = hit.gameObject.layer; // Plays the landing effect Quaternion normalRotation = Quaternion.LookRotation(Vector3.forward, hit.normal); if (ccc.State.IsGrounded && ccc.State.TimeFloating > land.minTime) { land.PlayEffect(hit.point, normalRotation, _characterSize.GetSize()); } // Calculates some values for the particles Vector3 eulerRotation = new Vector3(Mathf.PI + Vector3.Angle(Vector3.left, hit.normal) * Mathf.Deg2Rad, Mathf.PI / 2, 0); float sizeFactor = _characterSize.GetSize(); // Positions the walking effect if (ccc.State.IsGrounded) { _walkTrailEffect.position = hit.point; _walkTrailEffect.rotation = normalRotation; foreach (KeyValuePair<ParticleSystem, ParticleSystemState> system in _walkTrailParticleEffects) { system.Key.startRotation3D = eulerRotation; system.Value.UpdateWithSize(sizeFactor); } } // Positions the slope effect if (ccc.State.IsOnSlope && !ccc.State.IsSliding) { _slopeEffect.position = hit.point; _slopeEffect.rotation = normalRotation; foreach (KeyValuePair<ParticleSystem, ParticleSystemState> system in _slopeParticleEffects) { system.Key.startRotation3D = eulerRotation; system.Value.UpdateWithSize(Mathf.Sqrt(sizeFactor)); } } // Positions the sliding effect else if (ccc.State.IsSliding) { _slideEffect.position = hit.point; _slideEffect.rotation = normalRotation; foreach (KeyValuePair<ParticleSystem, ParticleSystemState> system in _slideParticleEffects) { system.Key.startRotation3D = eulerRotation; system.Value.UpdateWithSize(sizeFactor); } } }
public void OnPerformJump(CharacterControllerCustom ccc) { // Looks for the ground and plays the jump effect RaycastHit hit; if (Physics.SphereCast(ccc.transform.position, _controller.radius * _characterSize.GetSize(), ccc.Parameters.Gravity, out hit, 10, sceneMask)) jump.PlayEffect(hit.point, Quaternion.LookRotation(Vector3.forward, hit.normal), _characterSize.GetSize()); }
public virtual void OnWallJump(CharacterControllerCustom ccc) { // Do nothing }
public void OnWallJump(CharacterControllerCustom ccc) { // Plays the jump sound OnBeginJump(ccc, 0); }
public void OnPostCollision(CharacterControllerCustom ccc, ControllerColliderHit hit) { // Checks if the character is landing and plays the sound if (ccc.State.IsGrounded && ccc.State.TimeFloating > land.minTimeToPlay) land.PlayAudio(); }
public void OnBeginJump(CharacterControllerCustom ccc, float delay) { // Plays the jump sound modified by the character rooted size jump.PlayAudio(1.0f / Mathf.Sqrt(_characterSize.GetSize())); }
public void OnWallJump(CharacterControllerCustom ccc) { // Sets the wall jump trigger on the animator _animator.SetTrigger(CharacterAnimatorParameters.WallJump); }
/// <summary> /// Unity's method called right after the object is created. /// </summary> void Awake() { // Retrieves the desired components _ccc = GetComponentInParent<CharacterControllerCustom>(); _characterSize = GetComponentInParent<CharacterSize>(); _characterFusion = GetComponentInParent<CharacterFusion>(); _characterShoot = GetComponentInParent<CharacterShoot>(); _animator = GetComponent<Animator>(); _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); _drop = transform.parent.gameObject; }
public void OnPreCollision(CharacterControllerCustom ccc, ControllerColliderHit hit) { // Updates the collision speed float collisionSpeed = -_ccc.Velocity.y; _animator.SetFloat(CharacterAnimatorParameters.CollisionSpeed, collisionSpeed); }
public void OnPerformJump(CharacterControllerCustom ccc) { // Sets the jump trigger on the animator _animator.SetTrigger(CharacterAnimatorParameters.PerformJump); }
/// <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>(); }
void Awake() { // Retrieves the desired components _transform = transform; _ccc = GetComponent<CharacterControllerCustom>(); _characterSize = GetComponent<CharacterSize>(); _characterFusion = GetComponent<CharacterFusion>(); _characterShoot = GetComponent<CharacterShoot>(); _controller = GetComponent<CharacterController>(); _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); }
/// <summary> /// Initialize everything /// </summary> public void Awake() { _ccc = GetComponent<CharacterControllerCustom>(); _sizeDrop = GetComponent<CharacterSize>(); modelDrop = GetComponentInChildren<CharacterModelController>(); _trajectoryPoints = new Vector3[numOfTrajectoryPoints]; for (int i = 0; i < numOfTrajectoryPoints; i++) { _trajectoryPoints[i] = transform.position; } _linerenderer = (LineRenderer)Instantiate(renderer); _linerenderer.transform.parent = this.transform; //create the object where to store particles _rainParticles = new GameObject(); _rainParticles.transform.parent = this.transform; _rainParticles.name = "Rainbow Particle"; //we init only 20, we usually don't use more. If needed, will create more _particlesTrajectory = new List<ParticleSystem[]>(20); for (int i = 0; i < 20; i++) { GameObject system = Instantiate(particleRainbow); system.transform.parent = _rainParticles.transform; //initialize particle system ParticleSystem[] subSystems = system.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem subSystem in subSystems) { subSystem.randomSeed = (uint)UnityEngine.Random.Range(0, int.MaxValue); subSystem.Simulate(0, true, true); subSystem.Play(); ParticleSystem.EmissionModule emission = subSystem.emission; emission.enabled = false; } _particlesTrajectory.Add(subSystems); } }
/// <summary> /// Initialization method. /// The character start with size one /// </summary> public void Awake() { // Retrieves the desired components _layerCast = (1 << LayerMask.NameToLayer("Scene")); _dropTransform = gameObject.transform; _ratioRadius = GetComponent<CharacterController>().radius; _controller = GetComponent<CharacterControllerCustom>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); // Initialization _setState = false; _listeners = new List<CharacterSizeListener>(); //set the motionless situation clear _motionless = false; _motionlessTime = 0; //set the initial size if (initialSize <= 0) { initialSize = 1; } ChangeScale(Vector3.one * initialSize); _targetSize = initialSize; SetSize(initialSize); }
/// <summary> /// Unity's method called as soon as this entity is created. /// It will be called even if the entity is disabled. /// </summary> public void Awake() { // Recovers the other components _controller = GetComponent<CharacterControllerCustom>(); // By default, the player starts facing right FacingDirection = Vector3.right; }
public void OnPerformJump(CharacterControllerCustom ccc) { // Do nothing }
/// <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(); }
public void OnPreCollision(CharacterControllerCustom ccc, ControllerColliderHit hit) { // Do nothing }
public void OnBeginJump(CharacterControllerCustom ccc, float delay) { // Do nothing }
/// <summary> /// Unity's method called right after the object is created. /// </summary> void Awake() { // Retrieves the desired components _originalAudioSource = GetComponent<AudioSource>(); _ccc = GetComponent<CharacterControllerCustom>(); _characterSize = GetComponent<CharacterSize>(); _characterFusion = GetComponent<CharacterFusion>(); _characterShoot = GetComponent<CharacterShoot>(); // The walk's audio source is the original one walk.audioSource = _originalAudioSource; // Creates a copy of the audio source for the other sounds jump.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); land.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); fuse.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); shoot.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); hit.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); irrigate.audioSource = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); }
public virtual void OnPostCollision(CharacterControllerCustom ccc, ControllerColliderHit hit) { // Do nothing }