예제 #1
0
    void Update()
    {
        targetRotation = Quaternion.Euler(0, 0, 270 + MathStuff.GetRotationToLook(spriteTransfom.position, pointToLook));
        actualRotation = Quaternion.Lerp(actualRotation, targetRotation, rotationSpeed * Time.deltaTime);

        spriteTransfom.rotation = actualRotation;
    }
예제 #2
0
    void Shoot()
    {
        GameObject b = WeaponManager.instance.projectilePools[ammoType].getPooledObject();

        b.transform.position = transform.position;
        b.transform.rotation = Quaternion.Euler(0, 0, 180 + MathStuff.GetRotationToLook(b.transform.position, (Vector2)transform.position + InputManager.instance.GetAimDirection()));
        b.transform.Translate(Vector3.right * 0.5f, Space.Self);
        b.GetComponent <Rigidbody2D> ().velocity = b.transform.up * 30f;
        b.GetComponent <Projectile> ().Reset();

        WeaponManager.instance.fireEvent.Invoke();
    }