public override void Init() { base.Init(); StellaMove.SetAnimState(StellaMove.AnimType.Walk); StellaMove.SetAnimBool("Back", false); state = StateType.Walk; }
/// <summary> /// 星にぶら下がる。このアニメが完了するまでは、ステラに星をくっつける /// </summary> static void AttachStar() { OffsetFromStar = StellaMove.HoldPosition - Goal.StarPosition; Goal.FollowStella(); StellaMove.RegisterAnimEvent(FollowStar); state = StateType.Wait; }
public override void UpdateAction() { // つた掴みチェック if (StellaMove.CheckIvyHold()) { return; } // 行動ボタンチェック。着地時は何もしない if (Input.GetButton("Action") && !isLanding) { Actable act = StellaMove.ActionBoxInstance.GetActableInstance(); if (act != null) { if (act.Action()) { return; } } } StellaMove.instance.Gravity(); StellaMove.instance.Move(); if (!isLanding && StellaMove.chrController.isGrounded && StellaMove.myVelocity.y < 0f) { SoundController.Play(SoundController.SeType.Landing); StellaMove.myVelocity.x = 0; StellaMove.RegisterAnimEvent(Grounded); isLanding = true; StellaMove.CheckStepOn(); } }
public override void Init() { base.Init(); // 着地目標の座標を記録 targetPosition = StellaMove.instance.transform.position; targetPosition.y += fallHeight; // 開始位置を移動させる float mul = (startHeight - fallHeight) / fallVelocity.y; Vector3 spos = targetPosition; spos += (mul * fallVelocity); StellaMove.instance.transform.position = spos; StellaMove.SetAnimTrigger("StartDandelion"); // 綿毛の位置 GameObject go = Instantiate(fluffPrefab); go.GetComponent <Animator>().SetTrigger("Spawned"); fluffActable = go.GetComponent <FluffActable>(); fluffActable.Init(fallVelocity, -mul * 2f); fluffActable.SetPositionAndHold(StellaMove.instance.transform.position); // アニメ設定 StellaMove.SetAnimState(StellaMove.AnimType.Dandelion); StellaMove.myVelocity = Vector3.zero; startFrame = startSkipFrame; }
public override void Init() { base.Init(); StellaMove.myVelocity = Vector3.zero; StellaMove.SetAnimState(StellaMove.AnimType.Ivy); }
public override void UpdateAction() { switch (state) { case StateType.TargetWalk: StellaMove.AdjustWalkResult res = StellaMove.AdjustWalk(targetX, StellaMove.MoveSpeed); if (res == StellaMove.AdjustWalkResult.Reach) { state = StateType.Action; StellaMove.myVelocity = Vector3.zero; ToAction(); } else if (res == StellaMove.AdjustWalkResult.Abort) { // 移動できなければ歩きに戻します StellaMove.myVelocity = Vector3.zero; StellaMove.instance.ChangeAction(StellaMove.ActionType.NaeWalk); } break; case StateType.Action: StellaMove.myVelocity.x = 0f; StellaMove.instance.Move(); break; } }
public override void UpdateAction() { if (!jumpAbort) { // 中断チェック float to = StellaMove.targetJumpGround.x - StellaMove.instance.transform.position.x; if ((((to < 0f) && (Input.GetAxisRaw("Horizontal") >= 0f)) || ((to > 0f) && (Input.GetAxisRaw("Horizontal") <= 0f))) && !Input.GetButton("Action")) { jumpAbort = true; StellaMove.SetAnimFloat("JumpRev", -1f); } } else { // ジャンプ中断完了確認 if (StellaMove.AnimTime <= 0f) { StellaMove.SetAnimFloat("JumpRev", 1f); jumpAbort = false; StellaMove.SetAnimState(StellaMove.AnimType.Walk); StellaMove.instance.ChangeToWalk(); } } }
void Awake() { instance = this; chrController = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); anim.SetInteger("State", (int)AnimType.Walk); nowAction = ActionType.Walk; }
public override void Init() { base.Init(); fluffActable = ((FluffActable)ActionBox.SelectedActable); holded = false; StellaMove.RegisterAnimEvent(HoldStart); StellaMove.SetAnimState(StellaMove.AnimType.Dandelion); }
public override void Init() { base.Init(); state = StateType.TargetWalk; StellaMove.SetAnimState(StellaMove.AnimType.Walk); targetX = StellaMove.naePutPosition.x - (StellaMove.NaePutDownOffsetX + StellaMove.naeActable.NaeOffsetX) * StellaMove.forwardVector.x; }
public override void Init() { base.Init(); isLanding = false; StellaMove.SetAnimState(StellaMove.AnimType.Air); // X速度は歩き速度に入れる StellaMove.myVelocity.x = Mathf.Clamp(StellaMove.myVelocity.x, -StellaMove.MoveSpeed, StellaMove.MoveSpeed); }
/// <summary> /// 目的地を設定 /// </summary> public override void Init() { base.Init(); StellaMove.myVelocity = Vector3.zero; StellaMove.RegisterAnimEvent(Jump); StellaMove.SetAnimState(StellaMove.AnimType.Jump); StellaMove.SetAnimFloat("JumpRev", 1f); }
public override void Init() { base.Init(); SoundController.Play(SoundController.SeType.Obore); StellaMove.SetAnimState(StellaMove.AnimType.Obore); StellaMove.myVelocity.Set(0, oboreFall, 0); StellaMove.instance.Invoke("Restart", toRestartSeconds); StellaMove.instance.Splash(); }
/// <summary> /// 岩からステラへの方向に降ります。 /// </summary> /// <param name="top">床までの高さ</param> void GetOffOutside(float top) { float dir = StellaMove.chrController.bounds.center.x - lastRockObject.transform.position.x; float offset = StellaMove.chrController.bounds.extents.x + StellaMove.CollisionMargin + rockCollider.bounds.extents.x; float t = StellaMove.GetFallTime(top + StellaMove.MiniJumpMargin * 2f); float jumpt = StellaMove.GetFallTime(StellaMove.MiniJumpMargin); StellaMove.myVelocity.Set(offset * Mathf.Sign(dir) / t, jumpt * StellaMove.GravityAdd, 0f); StellaMove.instance.ChangeAction(StellaMove.ActionType.Air); }
/// <summary> /// 星に捕まる /// </summary> public static void HoldStar() { StellaMove.RegisterAnimEvent(AttachStar); // 左向きの時、Xを逆にする Vector3 sc = Vector3.one; sc.x = StellaMove.forwardVector.x; StellaMove.instance.transform.GetChild(0).localScale = sc; StellaMove.SetAnimState(StellaMove.AnimType.Clear); }
/// <summary> /// 目的地を設定 /// </summary> public override void Init() { base.Init(); StellaMove.myVelocity.y = 0f; StellaMove.RegisterAnimEvent(StellaMove.instance.StartTargetJump); StellaMove.SetAnimState(StellaMove.AnimType.Jump); StellaMove.SetAnimFloat("JumpRev", 1f); jumpAbort = false; }
void BackOff() { state = StateType.BackOff; targetX = StellaMove.naePutPosition.x - (StellaMove.ChrController.radius + StellaMove.naeActable.ColliderExtentsX) * StellaMove.forwardVector.x + StellaMove.CollisionMargin; // 前進はしない if ((targetX - StellaMove.instance.transform.position.x) * StellaMove.forwardVector.x > 0) { targetX = StellaMove.instance.transform.position.x; } StellaMove.SetAnimState(StellaMove.AnimType.Walk); }
public override void UpdateAction() { StellaMove.instance.Gravity(); StellaMove.instance.Move(); if (!isLanding && StellaMove.chrController.isGrounded) { StellaMove.myVelocity.x = 0; StellaMove.RegisterAnimEvent(Grounded); isLanding = true; } }
void Awake() { instance = this; chrController = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); anim.SetInteger("State", (int)AnimType.Walk); nowAction = ActionType.Walk; MapCollisionLayerMask = LayerMask.GetMask("MapCollision"); boxColliderHalfExtents.y = chrController.height * 0.5f - walkDownY; defaultLayer = LayerMask.NameToLayer("Player"); jumpLayer = LayerMask.NameToLayer("Jump"); ForwardVector = Vector3.right; }
public override void UpdateAction() { if (state != StateType.BackOff) { base.UpdateAction(); } else { // 調整を終えて、苗を下す if (StellaMove.AdjustWalk(targetX, StellaMove.MoveSpeed) != StellaMove.AdjustWalkResult.Continue) { ToWalk(); } } }
/// <summary> /// 星に捕まる /// </summary> public static void HoldStar() { // 左向きの時、Xを逆にする Vector3 sc = Vector3.one; sc.x = StellaMove.forwardVector.x; StellaMove.instance.transform.GetChild(0).localScale = sc; if (state == StateType.WaitAir) { // 空中なので、すぐに飛び去りへ FollowStar(); return; } StellaMove.RegisterAnimEvent(AttachStar); StellaMove.SetAnimState(StellaMove.AnimType.Clear); }
public override void UpdateAction() { if (state != StateType.BackOff) { base.UpdateAction(); } else { // 調整を終えて、苗を下す if (StellaMove.AdjustWalk(targetX, StellaMove.MoveSpeed) != StellaMove.AdjustWalkResult.Continue) { StellaMove.myVelocity.x = 0; StellaMove.naeActable.SetCollider(true); StellaMove.naeActable = null; StellaMove.instance.ChangeAction(StellaMove.ActionType.Walk); } } }
void Awake() { instance = this; chrController = GetComponent <CharacterController>(); anim = GetComponentInChildren <Animator>(); anim.SetInteger("State", (int)AnimType.Walk); NowAction = ActionType.Walk; MapCollisionLayerMask = LayerMask.GetMask("MapCollision"); boxColliderHalfExtents.y = chrController.height * 0.5f - walkDownY; defaultLayer = LayerMask.NameToLayer("Player"); jumpLayer = LayerMask.NameToLayer("Jump"); forwardVector = Vector3.right; splashParticle = transform.Find("Splash").GetComponent <ParticleSystem>(); splashParticle.transform.SetParent(null); Pivot = transform.Find("Pivot"); ActionBoxInstance = GetComponentInChildren <ActionBox>(); naeActable = null; ActionBoxInstance.Init(); }
/// <summary> /// 上下移動 /// </summary> void VerticalMove() { float v = Input.GetAxisRaw("Vertical"); StellaMove.myVelocity.y = v * upDownSpeed; // 登り切ったチェック if (v > 0.5f) { if (!StellaMove.IsIvyUp()) { // 前方に飛び降り StellaMove.myVelocity.x = StellaMove.MiniJumpSpeedMax * StellaMove.forwardVector.x; StellaMove.myVelocity.y = putDownSpeedY; StellaMove.instance.Gravity(); StellaMove.instance.Move(); StellaMove.instance.ChangeAction(StellaMove.ActionType.Air); return; } } // 移動 float lastY = StellaMove.instance.transform.position.y; CollisionFlags flags = StellaMove.ChrController.Move(StellaMove.myVelocity * Time.fixedDeltaTime); if (flags.HasFlag(CollisionFlags.Below) && StellaMove.myVelocity.y < 0f) { // 下にぶつかっていたらツタを離す StellaMove.myVelocity = Vector3.zero; StellaMove.instance.ChangeAction(StellaMove.ActionType.Walk); return; } float vely = (lastY - StellaMove.instance.transform.position.y) / Time.fixedDeltaTime; if (Mathf.Abs(vely) < Mathf.Abs(StellaMove.myVelocity.x)) { vely = StellaMove.myVelocity.x; } StellaMove.SetAnimFloat("VelY", vely); }
void Awake() { instance = this; ChrController = GetComponent <CharacterController>(); waterAudio = GetComponent <AudioSource>(); stellaAnimator = transform.Find("Pivot").GetComponentInChildren <Animator>(); stellaAnimator.SetInteger("State", (int)AnimType.Walk); NowAction = ActionType.Walk; boxColliderHalfExtents.y = ChrController.height * 0.5f - walkDownY; defaultLayer = LayerMask.NameToLayer("Player"); jumpLayer = LayerMask.NameToLayer("Jump"); forwardVector = Vector3.right; splashParticle = transform.Find("Splash").GetComponent <ParticleSystem>(); splashParticle.transform.SetParent(null); Pivot = transform.Find("Pivot"); ActionBoxInstance = GetComponentInChildren <ActionBox>(); naeActable = null; ActionBoxInstance.Init(); SoundController.audioListener.enabled = false; GetComponent <AudioListener>().enabled = true; }
/// <summary> /// ジャンプ実行 /// </summary> void Jump() { float h = Input.GetAxisRaw("Horizontal"); float t = StellaMove.GetFallTime(jumpHeight); StellaMove.myVelocity.y = t * StellaMove.GravityAdd; if (Mathf.Approximately(h, 0f)) { // 入力がない場合、前にstandardJump StellaMove.myVelocity.x = standardJump * StellaMove.forwardVector.x / t; } else { // 入力がある場合は、horizontalJump StellaMove.myVelocity.x = horizontalJump * h / t; } SoundController.Play(SoundController.SeType.MushroomJump); StellaMove.instance.ChangeAction(StellaMove.ActionType.Air); }
/// <summary> /// 目的地を設定 /// </summary> public override void Init() { base.Init(); StellaMove.SetAnimState(StellaMove.AnimType.Walk); targetX = Goal.instance.transform.position.x + Mathf.Sign(Goal.ClearFlyX) * StageManager.GoalToStellaOffset.x; state = StateType.ToTarget; float dir = targetX - StellaMove.instance.transform.position.x; // 向きが逆の時、方向転換から if ((dir * StellaMove.forwardVector.x) < 0f) { StellaMove.instance.StartTurn(dir); afterTurnState = StateType.ToTarget; state = StateType.Turn; } else { state = StateType.ToTarget; } }
/// <summary> /// 行動 /// </summary> public override void UpdateAction() { switch (state) { case StateType.Turn: if (StellaMove.chrController.isGrounded) { // 方向を確認 if (StellaMove.instance.Turn()) { state = afterTurnState; } } else { // 重力確認 StellaMove.instance.Gravity(); StellaMove.instance.Move(); } break; case StateType.ToTarget: // 移動 if (StellaMove.AdjustWalk(targetX, StellaMove.MoveSpeed) == StellaMove.AdjustWalkResult.Reach) { state = StateType.Wait; // 星が飛び去る方向と向きが逆の時、方向転換 if (StellaMove.forwardVector.x * Mathf.Sign(Goal.ClearFlyX) < 0f) { StellaMove.instance.StartTurn(-StellaMove.forwardVector.x); afterTurnState = StateType.Wait; state = StateType.Turn; } } break; } }
public override void UpdateAction() { switch (state) { case StateType.TargetWalk: StellaMove.AdjustWalkResult res = StellaMove.AdjustWalk(targetX, StellaMove.MoveSpeed); if ((res == StellaMove.AdjustWalkResult.Reach) || (res == StellaMove.AdjustWalkResult.Abort)) { state = StateType.Action; StellaMove.myVelocity = Vector3.zero; ToAction(); } /* * else if (res == StellaMove.AdjustWalkResult.Abort) * { * // 移動できなければ歩きに戻します * StellaMove.myVelocity = Vector3.zero; * * if (StellaMove.NowAction == StellaMove.ActionType.LiftUp) * { * ToWalk(); * } * else * { * StellaMove.instance.ChangeAction(StellaMove.ActionType.NaeWalk); * } * } */ break; case StateType.Action: StellaMove.myVelocity.x = 0f; StellaMove.instance.Move(); break; } }
public override void Init() { base.Init(); state = StateType.Start; StellaMove.SetAnimState(StellaMove.AnimType.Water); // アニメからイベントが呼ばれた時に、StartAction()を実行するように登録する StellaMove.RegisterAnimEvent(StartAction); // ステラの横移動を止めておく StellaMove.myVelocity.x = 0; if (zyouroParticle == null) { zyouroParticle = StellaMove.ZyouroEmitter.GetComponent <ParticleSystem>(); triggerSpeed = (zyouroParticle.main.startSpeed.constantMin + zyouroParticle.main.startSpeed.constantMax) * 0.5f; triggerEmitSeconds = triggerTime / (float)triggerCount; for (int i = 0; i < triggerCount; i++) { triggerObjects[i] = Instantiate(waterTrigger); triggerRigidbody[i] = triggerObjects[i].GetComponent <Rigidbody>(); triggerObjects[i].SetActive(false); triggerWater[i] = triggerObjects[i].GetComponent <Water>(); } } // じょうろの方向を設定 // index: 左0 右1 int index = StellaMove.forwardVector.x < 0 ? 0 : 1; StellaMove.ZyouroPivot.localEulerAngles = zyouroEular[index]; StellaMove.ZyouroPivot.localPosition = zyouroPivotPosition[index]; StellaMove.ZyouroEmitter.forward = StellaMove.forwardVector; StellaMove.ZyouroEmitter.parent = null; }