Beispiel #1
0
 /// <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();
     fluffActable = ((FluffActable)ActionBox.SelectedActable);
     holded       = false;
     StellaMove.RegisterAnimEvent(HoldStart);
     StellaMove.SetAnimState(StellaMove.AnimType.Dandelion);
 }
Beispiel #4
0
        /// <summary>
        /// 目的地を設定
        /// </summary>
        public override void Init()
        {
            base.Init();

            StellaMove.myVelocity = Vector3.zero;
            StellaMove.RegisterAnimEvent(Jump);
            StellaMove.SetAnimState(StellaMove.AnimType.Jump);
            StellaMove.SetAnimFloat("JumpRev", 1f);
        }
        /// <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;
        }
Beispiel #6
0
        /// <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);
        }
        public override void UpdateAction()
        {
            StellaMove.instance.Gravity();
            StellaMove.instance.Move();

            if (!isLanding && StellaMove.chrController.isGrounded)
            {
                StellaMove.myVelocity.x = 0;
                StellaMove.RegisterAnimEvent(Grounded);
                isLanding = true;
            }
        }
Beispiel #8
0
        /// <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);
        }
Beispiel #9
0
        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;
        }
Beispiel #10
0
        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();

            // 着地チェック
            bool isGrounded = StellaMove.ChrController.isGrounded;

            if (!isGrounded && (StellaMove.myVelocity.y < 0))
            {
                int hitCount = PhysicsCaster.CharacterControllerCast(
                    StellaMove.ChrController,
                    Vector3.down,
                    StellaMove.CollisionMargin,
                    PhysicsCaster.MapCollisionPlayerOnlyLayer);
                for (int i = 0; i < hitCount; i++)
                {
                    if (!PhysicsCaster.hits[i].collider.isTrigger)
                    {
                        isGrounded = true;
                    }
                }
            }

            // 着地チェック
            if (!isLanding && isGrounded && StellaMove.myVelocity.y < 0f)
            {
                SoundController.Play(SoundController.SeType.Landing);

                StellaMove.myVelocity.x = 0;
                StellaMove.RegisterAnimEvent(Grounded);
                isLanding = true;
                StellaMove.CheckStepOn();

                StageManager.SetFollowCameraTarget(StellaMove.instance.transform);
            }
            // 頭ぶつけチェック
            else if ((StellaMove.myVelocity.y > 0f) && StellaMove.IsHitHead)
            {
                SoundController.Play(SoundController.SeType.HitHead);
                StellaMove.myVelocity.y = 0f;
            }
        }
Beispiel #11
0
 /// <summary>
 /// 水まきを停止
 /// </summary>
 public override void End()
 {
     base.End();
     StellaMove.RegisterAnimEvent(null);
     zyouroParticle.Stop();
 }
Beispiel #12
0
 /// <summary>
 /// 目的地を設定
 /// </summary>
 public override void Init()
 {
     StellaMove.RegisterAnimEvent(StellaMove.instance.StartTargetJump);
     StellaMove.instance.SetAnimState(StellaMove.AnimType.Jump);
 }
Beispiel #13
0
 void PutDownNae()
 {
     SoundController.Play(SoundController.SeType.PutDown);
     StellaMove.RegisterAnimEvent(BackOff);
     StellaMove.naeActable.PutDown();
 }
Beispiel #14
0
 // 苗を離す
 void NaeOff()
 {
     StellaMove.SetAnimBool("Nae", false);
     StellaMove.RegisterAnimEvent(PutDownNae);
 }
Beispiel #15
0
 protected override void ToAction()
 {
     StellaMove.RegisterAnimEvent(PutDownNae);
     StellaMove.RegisterAnimEvent(NaeOff);
     StellaMove.SetAnimState(StellaMove.AnimType.PutDown);
 }
Beispiel #16
0
        public override void UpdateAction()
        {
            if (state == StateType.Action)
            {
                StellaMove.ZyouroEmitter.transform.position = StellaMove.ZyouroEmitterPosition.position;

                // 水オブジェクトを生成
                if (Time.time - lastTriggerTime >= triggerEmitSeconds)
                {
                    lastTriggerTime = Time.time;
                    triggerObjects[triggerIndex].SetActive(true);
                    triggerObjects[triggerIndex].transform.position = StellaMove.ZyouroEmitterPosition.position;
                    triggerRigidbody[triggerIndex].velocity         = StellaMove.ZyouroEmitter.forward * triggerSpeed;
                    triggerWater[triggerIndex].Start();
                    triggerIndex = (triggerIndex + 1) % triggerCount;
                }

                // 水まき終了チェック
                if (!Input.GetButton("Water") && (Grow.WaitGrowCount <= 0))
                {
                    // 水まき終了
                    state = StateType.End;
                    StellaMove.SetAnimState(StellaMove.AnimType.Walk);
                    StellaMove.RegisterAnimEvent(EndAction);
                    zyouroParticle.Stop();
                    return;
                }

                // 効果音
                if ((Time.time - lastSeTime) >= waterSeSeconds)
                {
                    lastSeTime = Time.time;
                    SoundController.Play(SoundController.SeType.Water);
                }

                // 後ずさりチェック
                float ofsy     = StellaMove.chrController.height * 0.49f - StellaMove.chrController.radius;
                int   hitCount = Physics.CapsuleCastNonAlloc(
                    StellaMove.chrController.bounds.center + Vector3.up * ofsy,
                    StellaMove.chrController.bounds.center + Vector3.down * ofsy,
                    StellaMove.chrController.radius,
                    Vector3.down,
                    hits,
                    0,
                    groundLayer);
                for (int i = 0; i < hitCount; i++)
                {
                    // 下げる
                    float colx   = hits[i].collider.bounds.extents.x;
                    float dist   = StellaMove.chrController.radius + colx + StellaMove.CollisionMargin;
                    float target = hits[i].transform.position.x - dist * StellaMove.forwardVector.x;
                    float move   = target - StellaMove.instance.transform.position.x;
                    if (move * StellaMove.forwardVector.x >= 0f)
                    {
                        // 向いている方向には動かさない
                        return;
                    }
                    StellaMove.myVelocity.x = move / Time.fixedDeltaTime;
                    Vector3 lastPos = StellaMove.instance.transform.position;
                    StellaMove.instance.Move();
                    lastPos.x = StellaMove.instance.transform.position.x;
                    StellaMove.instance.transform.position = lastPos;
                    StellaMove.myVelocity.x = 0f;
                }
            }
            else
            {
                StellaMove.instance.Gravity();
                StellaMove.instance.Move();
            }
        }
 void ToHold()
 {
     StellaMove.SetAnimBool("Nae", true);
     StellaMove.RegisterAnimEvent(ToHoldWalk);
 }
 void HoldNae()
 {
     SoundController.Play(SoundController.SeType.LiftUp);
     StellaMove.RegisterAnimEvent(ToHold);
     StellaMove.naeActable.Hold();
 }
 /// <summary>
 /// 行動へ
 /// </summary>
 protected override void ToAction()
 {
     StellaMove.RegisterAnimEvent(HoldNae);
     StellaMove.SetAnimState(StellaMove.AnimType.LiftUp);
 }