private IEnumerator StateSearch()
    {
        yield return(new WaitUntil(() => playerController.canMove));

        while (!isTargetAvailable)
        {
            targetCan = stageSearcher.GetHighScoreCan();
            yield return(null);
        }
        ChangeState(StateMove());
    }
예제 #2
0
 void OnValidate()
 {
     if (kickable == null)
     {
         kickable = GetComponent <Kickable>();
     }
     if (boxParts.Length == 0)
     {
         boxParts = boxPartsRoot.GetComponentsInChildren <Rigidbody>();
     }
 }
예제 #3
0
 /// <summary>
 /// Kickableをキックできるかどうか。
 /// 一回のキックは2つ以上の Kickable(缶や箱)をキックできないようにする。
 /// </summary>
 /// <param name="kickable"></param>
 /// <returns></returns>
 internal bool TryHit(Kickable kickable)
 {
     if (hitKickable == null)
     {
         hitKickable = kickable;
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #4
0
 protected override ActionBlock[] GetBlocks()
 {
     return(new [] {
         new ActionBlock("Kick", () => {
             vector = EditorGUILayout.Vector2Field("Value", vector);
             Kickable tool = (Kickable)target;
             if (GUILayout.Button("Kick"))
             {
                 tool.Kick(vector);
             }
         }),
     });
 }
예제 #5
0
 void OnValidate()
 {
     if (kickable == null)
     {
         kickable = GetComponent <Kickable>();
     }
     if (mRigidbody == null)
     {
         mRigidbody = GetComponent <Rigidbody>();
     }
     if (meshChild == null)
     {
         var mesh = GetComponentInChildren <MeshFilter>();
         meshChild = mesh.transform;
     }
 }
예제 #6
0
    void Kick()
    {
        playerSound.PlayKick();

        Collider2D collider = Physics2D.OverlapBox(transform.position + (LookingDirection * Vector3.right * 2f), Vector2.one, 0f, propsLayerMask);

        if (collider)
        {
            Kickable kickable = collider.GetComponent <Kickable>();
            if (kickable)
            {
                CameraShaker.Instance.ShakeOnce(3f, 5f, .1f, .2f);
                kickable.Kick(LookingDirection * Vector2.right * 5f);
            }
        }
    }
예제 #7
0
    /// <summary>
    /// キックコルーチン。
    /// 向き変えて、アニメーション開始して、コリジョン発生させる。
    /// </summary>
    /// <param name="kickPoint"></param>
    /// <returns></returns>
    internal IEnumerator Kick(Vector3 kickPoint)
    {
        isKicking   = true;
        hitKickable = null;

        var tdir = kickPoint - mTrans.position;

        StartCoroutine(LookAt(tdir, 0.3f));
        animatorCtrl.Kick();
        onKickStart.Invoke();
        yield return(new WaitForSeconds(kickTime));

        kickCollider.SetActive(false);
        isKicking = false;
        onKickEnd.Invoke();
    }