예제 #1
0
    void ChangeState(LanternState pLanternState)
    {
        switch (pLanternState)
        {
        case LanternState.following:     //start following
            velocity = Vector3.zero;
            GetComponent <Rigidbody2D>().isKinematic = true;
            GetComponent <Rigidbody2D>().isKinematic = false;

            break;

        case LanternState.charging:     //start charging lantern
            CursorToggle = StartCoroutine(ToggleCursor());
            if (AimParticleSystem != null)
            {
                ParticleSystem.EmissionModule emission = AimParticleSystem.emission;
                emission.enabled = true;
            }
            break;

        case LanternState.moving:     //start moving/shooting
            StopCoroutine(CursorToggle);
            ShootParticleSystem.transform.LookAt(Player.position);
            ShootParticleSystem.Play();
            velocity = dirToMouse.normalized * shootSpeed;
            break;

        case LanternState.placed:     //start idle
            GetComponent <Rigidbody2D>().isKinematic = false;
            GetComponent <Rigidbody2D>().isKinematic = true;
            GetComponent <Rigidbody2D>().velocity   *= 0;
            break;
        }
        CurrentState = pLanternState;
    }
예제 #2
0
    void ChangeState(LanternState pLanternState)
    {
        switch (pLanternState)
        {
        case LanternState.following:     //start following
            velocity = Vector3.zero;
            GetComponent <Rigidbody2D>().isKinematic = true;
            GetComponent <Rigidbody2D>().isKinematic = false;

            break;

        case LanternState.idle:     //start idle
            break;
        }
        CurrentState = pLanternState;
    }