public override void RunLateUpdate()
        {
            if (TargetHead != null)
            {
                NeutralTargetPos   = TargetHead.position - (Vector3.up * 0.25f);
                NeutralTargetPos.z = 0f;

                NeutralNeckPos   = Neck.transform.position;
                NeutralNeckPos.z = 0f;

                NeckDir = NeutralNeckPos - NeutralTargetPos;

                //Debug.Log(NeckDir);

                if (CONTROL_MECHANISM.IsFacingForward())
                {
                    NeckDir += new Vector3(-3f, 0f, 0f);
                }
                else
                {
                    NeckDir += new Vector3(3f, 0f, 0f);
                }

                Neck.transform.LookAt(Neck.transform.position + NeckDir, Vector3.up);
                Head.transform.LookAt(Neck.transform.position + NeckDir, Vector3.up);
                //Neck.forward = NeckDir;
                //Head.forward = NeckDir;
            }
        }
Exemple #2
0
        public override void RunFrameUpdate()
        {
            if (UpdateAnimation())
            {
                //Debug.Log(ANIMATION_DATA.PlayTime);
                if (DurationTimePassed())
                {
                    characterStateController.ChangeState((int)PlayerState.HumanoidIdle);
                    return;
                }

                if (attack.UpdateHit(TouchDetectorType.ATTACK_RIGHT_FOOT, ref attack.Target))
                {
                    if (attack.Target.characterStateController.CurrentState.ANIMATION_DATA.characterAnimator.GetFloat("DeathAnimationIndex") == 1f)
                    {
                        if (!attack.Target.moveData.IsGrounded)
                        {
                            CharacterDeath targetDeathState = attack.Target.characterStateController.CurrentState as CharacterDeath;

                            if (CONTROL_MECHANISM.IsFacingForward())
                            {
                                targetDeathState.CONTROL_MECHANISM.transform.rotation = Quaternion.Euler(new Vector3(0f, 180f, 0f));
                            }
                            else
                            {
                                targetDeathState.CONTROL_MECHANISM.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
                            }

                            targetDeathState.ProcSpinKickReaction();
                        }
                    }
                }
            }
        }
		public override void InitState () {
			ANIMATION_DATA.DesignatedAnimation = PlayerState.PlayerCombo2_3_GroundShock.ToString ();

			CONTROL_MECHANISM.BodyTrailDictionary[BodyTrail.BACK].gameObject.SetActive (false);
			CONTROL_MECHANISM.BodyTrailDictionary[BodyTrail.BACK].gameObject.SetActive (true);

			Vector3 footPos = new Vector3 (CONTROL_MECHANISM.BodyPartDictionary[BodyPart.RIGHT_FOOT].position.x, CONTROL_MECHANISM.BodyPartDictionary[BodyPart.RIGHT_FOOT].position.y + 0.1f, 0f);
			VFX_MANAGER.ShowSimpleEffect (SimpleEffectType.GROUND_SHOCK, footPos);
			VFX_MANAGER.ShowSimpleEffect (SimpleEffectType.GROUND_SMOKE, footPos);

			//CONTROL_MECHANISM.BodyTrailDictionary[BodyTrail.BODY].gameObject.SetActive (false);
			//CONTROL_MECHANISM.BodyTrailDictionary[BodyTrail.BODY].gameObject.SetActive (true);

			//comboTransition.Reset ();

			attack.AttackAnimationMotionTriggered = false;
			CONTROL_MECHANISM.RIGIDBODY.AddForce (Vector3.up * 200f);

			CameraOffsetType camOffsetType = CameraOffsetType.ZOOM_ON_GROUND_SHOCK_LEFT;
			if (!CONTROL_MECHANISM.IsFacingForward ()) {
				camOffsetType = CameraOffsetType.ZOOM_ON_GROUND_SHOCK_RIGHT;
			}
			CAMERA_MANAGER.gameCam.SetOffset (camOffsetType, 0.65f);
			CAMERA_MANAGER.gameCam.playerFollow.SetFollow (PlayerFollowType.FOCUS_ON_HEAD);
			Time.timeScale = 0.45f;
		}
Exemple #4
0
 private void SetDefaultTilt()
 {
     if (CONTROL_MECHANISM.IsFacingForward())
     {
         ANIMATION_DATA.characterAnimator.transform.eulerAngles = new Vector3(0, 90f, 0);
     }
     else
     {
         ANIMATION_DATA.characterAnimator.transform.eulerAngles = new Vector3(0, -90f, 0);
     }
 }
Exemple #5
0
        private void UpdateFallTilt()
        {
            float forwardLook = -1f;

            if (!CONTROL_MECHANISM.IsFacingForward())
            {
                forwardLook = 1f;
            }
            if (ANIMATION_DATA.characterAnimator.transform.eulerAngles.x >= 12.5f * forwardLook)
            {
                ANIMATION_DATA.characterAnimator.transform.Rotate(Vector3.forward * Time.deltaTime * 15f * forwardLook, Space.World);
            }
        }
Exemple #6
0
 bool IsPastWayPoint()
 {
     if (CONTROL_MECHANISM.IsFacingForward())
     {
         if (CONTROL_MECHANISM.transform.position.x > AI_CONTROL.GetNextWayPoint().transform.position.x)
         {
             return(true);
         }
     }
     else
     {
         if (CONTROL_MECHANISM.transform.position.x < AI_CONTROL.GetNextWayPoint().transform.position.x)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #7
0
        public override void RunFixedUpdate()
        {
            if (ANIMATION_DATA.AnimationNameMatches)
            {
                CheckDive();
                CommitDive();
                DashBeforeRoll();
                Roll();

                if (ANIMATION_DATA.PlayTime > FallTime)
                {
                    if (!move.IsGoingToLand())
                    {
                        if (CONTROL_MECHANISM.IsFacingForward())
                        {
                            MOVEMENT_DATA.AirMomentum = 3f;
                        }
                        else
                        {
                            MOVEMENT_DATA.AirMomentum = -3f;
                        }

                        //if (IsDiving) {
                        //	if (CONTROL_MECHANISM.IsFalling()){}
                        //}
                    }

                    if (CONTROL_MECHANISM.IsFalling())
                    {
                        characterStateController.ChangeState((int)PlayerState.FallALoop);
                        return;
                    }
                }
            }
            else
            {
                move.MoveForward(MOVEMENT_DATA.RunSpeed * 1.05f, CHARACTER_TRANSFORM.rotation.eulerAngles.y);
            }
        }
Exemple #8
0
        private bool RollAfterJump()
        {
            if (MOVEMENT_DATA.AirMomentum < 4.8f)
            {
                return(false);
            }

            if (CONTROL_MECHANISM.IsFacingForward())
            {
                if (MOVEMENT_DATA.MoveForward)
                {
                    return(true);
                }
            }
            else if (!CONTROL_MECHANISM.IsFacingForward())
            {
                if (MOVEMENT_DATA.MoveBack)
                {
                    return(true);
                }
            }
            return(false);
        }
		public override void RunFixedUpdate () {
			if (ANIMATION_DATA.AnimationNameMatches) {
				if (ANIMATION_DATA.PlayTime < 0.6f) {
					if (!MOVEMENT_DATA.IsGrounded) {
						move.MoveForward (MOVEMENT_DATA.RunSpeed * 0.65f, CHARACTER_TRANSFORM.rotation.eulerAngles.y);
					}
				}

				//hangtime
				if (ANIMATION_DATA.PlayTime > 0.48f) {
					ResetCameraToNormal ();
					if (!MOVEMENT_DATA.IsGrounded) {
						if (ANIMATION_DATA.AnimationIsPlaying ()) {
							ANIMATION_DATA.StopAnimation ();
						}
					}

					if (!ANIMATION_DATA.AnimationIsPlaying ()) {
						if (MOVEMENT_DATA.IsGrounded) {
							ANIMATION_DATA.PlayAnimation ();
						}
					}
				}

				//show effect - motion, cam shake
				if (ANIMATION_DATA.PlayTime > 0.515f) {
					if (MOVEMENT_DATA.IsGrounded) {
						if (!attack.AttackAnimationMotionTriggered) {
							attack.AttackAnimationMotionTriggered = true;
							GameObject sm = VFX_MANAGER.ShowSimpleEffect (SimpleEffectType.MOTION_STRAIGHT_ATTACK, CONTROL_MECHANISM.transform.position);
							if (!CONTROL_MECHANISM.IsFacingForward ()) {
								sm.transform.rotation = Quaternion.Euler (0, 180, 0);
							} else {
								sm.transform.rotation = Quaternion.Euler (0, 0, 0);
							}
							CAMERA_MANAGER.ShakeCamera (0.4f);
						}
					}
				}

				//show effect - ground effect
				if (ANIMATION_DATA.PlayTime > 0.55f) {
					if (attack.AttackAnimationMotionTriggered && !GroundEffectShown) {
						GroundEffectShown = true;
						GameObject nt = VFX_MANAGER.ShowSimpleEffect (SimpleEffectType.NITRONIC, CONTROL_MECHANISM.transform.position);
						if (!CONTROL_MECHANISM.IsFacingForward ()) {
							nt.transform.rotation = Quaternion.Euler (0, 180, 0);
						} else {
							nt.transform.rotation = Quaternion.Euler (0, 0, 0);
						}
						VFX_MANAGER.ShowSimpleEffect (SimpleEffectType.GROUND_IMPACT_DUST, CONTROL_MECHANISM.transform.position);

						//need to be more specific later
						foreach (ControlMechanism e in CHARACTER_MANAGER.ListEnemies) {
							if (e.characterStateController.CurrentState.GetType () != typeof (CharacterDeath)) {
								float dist = Vector3.Distance (e.transform.position, CONTROL_MECHANISM.transform.position);
								//Debug.Log (e.gameObject.name + " distance to player: " + dist);
								if (dist < 1.8f) {
									e.characterStateController.DeathCause = "GroundShock";
									e.characterStateController.ChangeState (999);
								}
							}
						}
					}
				}
			} else {
				move.MoveForward (MOVEMENT_DATA.RunSpeed * 0.7f, CHARACTER_TRANSFORM.rotation.eulerAngles.y);
			}
		}