コード例 #1
0
    private void SpawnProjectTile(Vector3 Buf)
    {
        Rigidbody2D ArrowClone;

        Angle = Vector3.Angle(new Vector3(1f, 0f, 0f), Buf);
        if (Buf.y < 0)
        {
            Angle *= -1f;
        }
        ArrowClone = Instantiate(ProjectTile, transform.position, Quaternion.Euler(0f, 0f, Angle));
        ArrowClone.AddForce(Buf.normalized * 5f, ForceMode2D.Impulse);
    }
コード例 #2
0
    private void SpawntProjectTile()
    {
        float       Angle;
        Rigidbody2D ArrowClone;
        Vector3     Buf = (Target.transform.position - transform.position);

        Angle = Vector3.Angle(new Vector3(1f, 0f, 0f), Buf);
        if (Buf.y < 0)
        {
            Angle *= -1f;
        }
        ArrowClone = (Rigidbody2D)Instantiate(ProjectTileDirect, transform.position, Quaternion.Euler(0f, 0f, Angle));
        ArrowClone.AddForce(Buf.normalized * 5f, ForceMode2D.Impulse);
    }