Ejemplo n.º 1
0
        private void FixedUpdate()
        {
            var color = SpriteRenderer.color;

            switch (State)
            {
            case BaitState.Holding:
                SpriteRenderer.color = new Color(color.r, color.g, color.b, 0.5f);
                break;

            case BaitState.Flying:
                m_flyingTimer                   += Time.fixedDeltaTime;
                SpriteRenderer.color             = new Color(color.r, color.g, color.b, 0.0f);
                ShowingSprite.transform.position = m_from + m_direction * (m_flyingTimer / FlyingTime);
                if (m_flyingTimer >= FlyingTime)
                {
                    State = BaitState.Dying;
                    Controller.SetTarget(transform);
                }
                break;

            case BaitState.Dying:
                m_dyingTimer += Time.fixedDeltaTime;
                if (m_dyingTimer >= Lifetime)
                {
                    Destroy(gameObject);
                }
                break;
            }
        }
Ejemplo n.º 2
0
 public void Hold(Transform parent)
 {
     transform.SetParent(parent);
     transform.localPosition = Vector3.zero;
     m_dyingTimer            = 0;
     State = BaitState.Holding;
     ShowingSprite.gameObject.SetActive(false);
 }
Ejemplo n.º 3
0
 public void Throw(PlayerController.PlayerController thrower)
 {
     m_from = thrower.transform.position;
     State  = BaitState.Flying;
     ShowingSprite.gameObject.SetActive(true);
     ShowingSprite.transform.position = m_from;
     m_direction = transform.position - m_from;
 }
Ejemplo n.º 4
0
    void Awake()
    {
        Physics.gravity = Vector3.up * -9.8f;
        state           = BaitState.MOVE_TO_GROUND;
        anim            = GetComponent <Animator>();
        rd = GetComponent <Rigidbody>();

        fadeImage = fade.GetComponent <Image>();
    }
Ejemplo n.º 5
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("Ground"))
     {
         if (state == BaitState.MOVE_TO_GROUND)
         {
             rd.constraints = rd.constraints | RigidbodyConstraints.FreezePositionY;
             freezeY        = transform.position.y;
             state          = BaitState.MOVE_AROUND;
         }
     }
 }
Ejemplo n.º 6
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            if (state == BaitState.MOVE_AROUND)
            {
                sound_single.Instance.PlayFishingUP();
                state = BaitState.CASTING;
                fisingCable.SetBaitBind(false);

                StartCoroutine(FadeOut());
                StartCoroutine(Next());
            }
        }
        switch (state)
        {
        case BaitState.COL_ENEMY:
            break;

        case BaitState.CASTING:
            break;
        }
    }
Ejemplo n.º 7
0
 private void Awake()
 {
     State = BaitState.Idle;
 }
Ejemplo n.º 8
0
 public void SetState(BaitState state)
 {
     this.state = state;
 }